-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Exporting constants breaks minification #820
Comments
I am also encountering this problem. I believe the issue may be that the To reproduce, run: const babel = require('@babel/core');
const foldingPlugin = require('babel-plugin-minify-constant-folding')
const js = `const foo = "foo"; export { foo };`;
babel.transformSync(js, {plugins: [foldingPlugin]}); Which throws:
The correct behavior would be not to perform identifier substitutions inside ExportSpecifiers. Versions:
|
FYI if you're using |
@aomarks Thanks! Not sure how I completely missed that documentation originally. |
Disable Babel `minify-constant-folding` plugin when minifying. This plugin has a bug that breaks when a constant is exported from a module (babel/minify#820). Fixes https://github.com/Polymer/polymer-cli/issues/998
Disable Babel `minify-constant-folding` plugin when minifying. This plugin has a bug that breaks when a constant is exported from a module (babel/minify#820). Fixes https://github.com/Polymer/polymer-cli/issues/998
Input Code
Actual Output
Expected Output
I should be able to export my constants without compilation issues
Details
If there is another way I should be defining this, or a way I can use the preset and omit the constant folding, that would work as an interim solution.
EDIT: Removed some of the verbosity of the backtrace for easier reading
The text was updated successfully, but these errors were encountered: