dygraphs icon indicating copy to clipboard operation
dygraphs copied to clipboard

npm run build fails to minify

Open ghost opened this issue 6 years ago • 3 comments

Some third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.

To resolve this: Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled. Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the module field in package.json. Note that even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers.

ghost avatar May 03 '18 14:05 ghost

I am observing the same problem here with dygraphs 2.1.0

yarn build

Failed to minify the code from this file: ./node\\\\\_modules/dygraphs/src/dygraph-utils.js:325 Read more here: http://bit.ly/2tRViJ9

Is there any hope that the problem could be resolved soon?

Thank you very much!

mkreim avatar Jul 11 '18 07:07 mkreim

Can you use index.es5.js? The dygraphs/package.json file point at this as "main", it only references index.js as main:jsnext.

danvk avatar Jul 11 '18 13:07 danvk

Hi danvk,

thanks a lot for that hint. It seems that a import Dygraph from "dygraphs/index.es5" resolves the problem in my react app. I let you know if I run into any further problems regarding the build command.

Thanks a lot and best regards

mkreim avatar Jul 12 '18 06:07 mkreim