When using the following polymer.json settings, the es5 bundle fails to transpile and minify:
"builds": [
{
"preset": "es5-bundled",
"addServiceWorker": false,
"bundle": true,
"js": {
"minify": true,
"compile": "es5",
"transformModulesToAmd": true
},
"css": {
"minify": true
},
"html": {
"minify": true
}
}
]
The following error is thrown:
{ err: 'Cannot read property \'isIfStatement\' of null' }
This seems to be a problem with babel-preset-minify that was fixed in 0.5.0: https://github.com/babel/minify/issues/850
We tracked the issue down to the polymer legacy adapter, and we think it was caused by a change in class.js (https://github.com/Polymer/polymer/blob/master/lib/legacy/class.js). Rather than find the line causing the error, I think this would be fixed by updating polymer build's version of babel-preset-minify: https://github.com/Polymer/tools/blob/master/packages/build/package.json#L68.
(If I should open an issue there, please let me know!)
If we instead use "minify": false, the transpiling works as expected.
v3.2.0 (v3.1.0 works properly)Thanks for the report. cc: @usergenic re: polymer-bulild babel dependency.
Looking into this now.
FWIW, I updated babel-preset-minify to latest ^0.5.0 and there's a { err: 'Cannot read property \'isPure\' of null' } now. Still working on this issue. Related/duplicate issue: https://github.com/Polymer/tools/issues/717
Am considering replacing babel-preset-minify with uglify-es.
Then I got { err: 'Couldn\'t find intersection' }...
Managed to get things passing again by disabling a couple of the babel-preset-minify plugins. Hopefully can get https://github.com/Polymer/tools/pull/3388 merged in and cut a polymer-build+CLI release very shortly.
Published [email protected] and [email protected] fixing this issue.
Thanks for reporting this @svanherk
Thanks for the quick response @usergenic, everything is looking good on our end with version 3.2.0 now
This is still an issue on Polymer 3.3.1.
@kobleistvan what version of polymer-cli do you have installed?
@arthurevans "polymer-cli": "1.9.7",
(Because anything above it won't strip out comments :/ )
OK. This issue was fixed in 1.9.8, but I gather that version introduced the regression in comment handling.
Since there's no new work being done on the Polymer CLI, I'd recommend migrating to an alternate bundler. We've been recommending the open-wc Rollup configuration as a starting point, for example.
We'll give that a try. Thanks, much appreciated!
On Wed, Apr 8, 2020, 21:06 Arthur Evans notifications@github.com wrote:
OK. This issue was fixed in 1.9.8, but I gather that version introduced
the regression in comment handling.Since there's no new work being done on the Polymer CLI, I'd recommend
migrating to an alternate bundler. We've been recommending the open-wc
Rollup configuration as a starting point, for example.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Polymer/polymer/issues/5515#issuecomment-611107673,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABSU2RIIGCK7ZYAF5DMHARTRLS4I3ANCNFSM4HB3ERPQ
.
Most helpful comment
Published [email protected] and [email protected] fixing this issue.