Tagify: Failed to minify the code from this file: ./node_modules/@yaireo/tagify/dist/react.tagify.js:5

Created on 27 Mar 2020  路  6Comments  路  Source: yairEO/tagify

I've got a project set up in Visual Studio 2019 using CRA. When I try to publish the solution, the build process gets interrupted.

This is the content of the output window:

npm run build

xyz build C:...\ClientApp
react-scripts build

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

    ./node_modules/@yaireo/tagify/dist/react.tagify.js:5 

Read more here: http://bit.ly/2tRViJ9

Can anybody help? Thanks.

All 6 comments

I will look into it

I've found this info in my read.md file inside my project template.

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:

  1. 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.
  2. Fork the package and publish a corrected version yourself.

  3. If the dependency is small enough, copy it to your src/ folder and treat it as application code.

Appearantly the dependent code is not compiled inside the build process, hence my question: is there any way, you could update your package with pre-compiled code?

Thanks.

Hmm. it might be that the react.tagify.js itself uses import statements and those are ES2015. tagify.js itself is transpiled to ES5, but the React wrapper isn't, so I will try and let you know, thanks!

Yeah, I'm pretty sure that that's the problem. I've transpiled the React code and placed it in the node-modules folder. The build process runs smoothly now. Is there any way you can place the transpiled version of the react file in the npm package? Thanks.

I just worked on this today and will release a new version to the NPM in the coming days (hopefully even tomorrow)

thanks. that sounds very good.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mushr0000m picture Mushr0000m  路  6Comments

erniomaldo picture erniomaldo  路  5Comments

8483 picture 8483  路  4Comments

thetuningspoon picture thetuningspoon  路  4Comments

biznickman picture biznickman  路  6Comments