Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postMinifyProcess and postProcessBundleSourcemap not working #400

Open
devattendant opened this issue May 2, 2019 · 4 comments
Open

postMinifyProcess and postProcessBundleSourcemap not working #400

devattendant opened this issue May 2, 2019 · 4 comments

Comments

@devattendant
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
The documentation at https://facebook.github.io/metro/docs/en/configuration lists two parameters postMinifyProcess and postProcessBundleSourcemap which I both tried to use to hook into bundle creation. While both are documented, they are actually not implemented.

I have added calling postProcessBundleSourcemap in metro/src/server.js to get it working at least temporarily but I failed to get postMinifyProcess working as it is deleted from the config after a short time and not passed to the transformer, even if I remove the deletion at metro/src/DeltaBundler/Transformer.js.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.
I've modified metro.config.js like the following, but there is no output:
module.exports = { resetCache: true, transformer: { getTransformOptions: async () => ({ transform: { experimentalImportSupport: false, inlineRequires: false, }, }), minifierPath: 'metro-minify-terser', postMinifyProcess: ({ code, map }) => { console.log("postMinifyProcess") return { code, map }; } } };

What is the expected behavior?
Both postMinifyProcess and postProcessBundleSourcemap should be called or removed in documentation.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
Metro 0.51.1, RN 0.59.5, metro.config.js see above.

@TheHighriser
Copy link

Same problem here. Still not working. Is there anything working in the Serializer config?

@dominikfoldi
Copy link

dominikfoldi commented Oct 9, 2019

We are building a JavaScript code optimizer and we want to create a Metro plugin which would be a good fit as the postMinifyProcess or postProcessBundleSourcemap. It is really not implemented why is it the case?

@vividh
Copy link

vividh commented Nov 4, 2019

👍
Please implement this!

@EmilijusS
Copy link

Still not working.

facebook-github-bot pushed a commit that referenced this issue May 12, 2021
Summary:
The `postMinifyProcess` does not currently work in Metro and has apparently been broken since Metro v0.33.0 (380ad71). Here we delete it from the type definitions and documentation.

We can separately discuss redesigning and reintroducing this extension point, but it's likely not necessary: Users of Metro can already replace the minifier with their own implementation - e.g. one that calls the regular minifier and does any additional processing that would go in `postMinifyProcess`.

Related: #400.

Reviewed By: MichaReiser

Differential Revision: D28291508

fbshipit-source-id: 36babc6275de9801503c4ec0139c5ca5d0ab5bfa
krystofwoldrich added a commit to krystofwoldrich/metro that referenced this issue Nov 4, 2022
…nted

As the issue mentions the function is not implemented therefore I thought it should be removed from the public docs.

facebook#400
facebook-github-bot pushed a commit that referenced this issue Dec 19, 2022
…fig (#890)

Summary:
Remove docs, type and config default for the non-implemented `postProcessBundleSourcemap`

Changelog:
**[Breaking]** Remove `postProcessBundleSourcemap` from config

*(Breaks consumers relying on the config default being populated with a function.)*

-- Original PR description follows --

As [the issue](#400) mentions the function is not implemented therefore I thought it should be removed from the public docs.

- #400

Pull Request resolved: #890

Test Plan: This is only a docs update no need for testing.

Reviewed By: jacdebug

Differential Revision: D41161760

Pulled By: robhogan

fbshipit-source-id: bd57f9db2192f16afec66dc85a1a6180dda84b89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants