On CRA web apps, a dependency of engine.io-client cannot be minified
dennisat opened this issue · comments
Error, CRA
Failed to minify the code from this file:
./node_modules/engine.io/node_modules/debug/src/browser.js:155
You want to:
- report a bug
- request a feature
Current behaviour
In CRA applications, on the build of the app, the minifier cannot minify the engine.io/node_modules/debug/src/browser.js
dependency file because is not in ES5.
This is not a problem of engine.io-client it self, but the debug
raises this exception on build and CRA apps cannot be deployed :(.
A question would be why the debug
is a dependency and not dev dependency?
Steps to reproduce (if the current behaviour is a bug)
- In a CRA web application app, import the "engine.io-client".
- and Build
Expected behaviour
No build errors on CRA that minifies the dist version.
Setup
- OS: Doesn't matter
- browser: Doesn't matter, is a build issue
- engine.ioversion: 3.4.0
- engine.io-client version: 3.4.0
Other information (e.g. stacktraces, related issues, suggestions how to fix)
- Move the
debug
dep as dev dependency, in any way doesn't do anything in production (or it shouldn't) - Downgrade if possible the
debug
or request to improve their dist to be in es5.
I don't think the transformation from ES6 to ES5 should be done here.
Regarding the debug
dependency, I think we must be able to provide two builds, one for development (with debug) and one for production (without debug). So doing the following is not possible, as it will exclude debug in any case:
// package.json
{
"browser": {
"debug": "./noop.js"
}
}
In socket.io-client (which include this library), we use the NormalModuleReplacementPlugin of webpack. I don't know what exactly a "CRA web application" is, would this solution work for you?