admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

Failed to minify the code from this file #546

Open zcmgyu opened 6 years ago

zcmgyu commented 6 years ago

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. https://github.com/alexgorbatchev/node-crc/pull/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"
  },