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

Failed to minify the code from this file #546

Open
zcmgyu opened this issue Jul 27, 2018 · 0 comments
Open

Failed to minify the code from this file #546

zcmgyu opened this issue Jul 27, 2018 · 0 comments

Comments

@zcmgyu
Copy link

zcmgyu commented Jul 27, 2018

When I build create-react-app project while WD was imported, it throws below error message.

Failed to minify the code from this file:

        ./node_modules/crc/create_buffer.js:7

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

Error line: https://github.com/alexgorbatchev/node-crc/blob/master/create_buffer.js#L7

To resolve this I should do something like below suggestion but I don't know how to do it with WD project. I really appreciate if you should tell me what should I do to resolve it. Thanks <3

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

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

Nested dependency flow:
wd > achiver (2.1.1) > zip_stream (1.2.0) > compress_common (1.2.2) > crc32_stream (2.0.0) > crc (3.7.0)
UPDATE:
I found problem. main path of node-crc repo's package is wrong. Author add ./ in front of path, it makes compiler read pre-compiled code instead of compiled code.
I also make a pull-request in below.
alexgorbatchev/crc#57

To bypass this issue, i added resolution key into package.json to override all crc package in same version (ES5 source code)

// package.json
"resolutions": {
    "crc": "3.5.0"
  },
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

1 participant