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
webpack@4 - ERROR in TypeError: __webpack_require__(...) is not a function #6544
Comments
There's a couple things that could be problems here so I'm going to try and suggest a few things.
|
Thanks for helping @TheLarkInn.
Anyway mode:production doesn't work either because I get a similar error and I'm trying to have the development environment up and running before moving to the production one. Here what I get running
=>
...and after the errors webpack-cli prompts the manual 🤨 (I'm passing NODE_ENV anyway down to the js bundle) |
The error is caused by the html-webpack-plugin. Best report it there. Otherwise sideEffects seem to be working. Only these modules from lodash are included. There are also concatenated into a single module: [12] ./app/index.js + 20 modules 13 KiB {0} [built]
| ./node_modules/lodash-es/_hasUnicode.js 945 bytes [built]
| ./app/index.js 73 bytes [built]
| ./node_modules/lodash-es/toString.js 577 bytes [built]
| ./node_modules/lodash-es/upperFirst.js 466 bytes [built]
| ./node_modules/lodash-es/_baseToString.js 1.12 KiB [built]
| ./node_modules/lodash-es/_createCaseFirst.js 769 bytes [built]
| ./node_modules/lodash-es/_castSlice.js 512 bytes [built]
| ./node_modules/lodash-es/isSymbol.js 673 bytes [built]
| ./node_modules/lodash-es/_Symbol.js 114 bytes [built]
| ./node_modules/lodash-es/_arrayMap.js 554 bytes [built]
| ./node_modules/lodash-es/capitalize.js 526 bytes [built]
| ./node_modules/lodash-es/_stringToArray.js 439 bytes [built]
| ./node_modules/lodash-es/isArray.js 484 bytes [built]
| ./node_modules/lodash-es/_baseGetTag.js 780 bytes [built]
| ./node_modules/lodash-es/_asciiToArray.js 298 bytes [built]
| ./node_modules/lodash-es/_unicodeToArray.js 1.59 KiB [built]
| ./node_modules/lodash-es/isObjectLike.js 611 bytes [built]
| ./node_modules/lodash-es/_baseSlice.js 751 bytes [built]
| ./node_modules/lodash-es/_root.js 296 bytes [built]
| ./node_modules/lodash-es/_objectToString.js 562 bytes [built]
| ./node_modules/lodash-es/_getRawTag.js 1.11 KiB [built] Minimized you pay only 2.1kB (1kB.gz) for lodash usage. The most expensive part seem to be the |
webpack-cli help also seem like a bug to me. Best report it to webpack-cli. In no longer happens when the html-webpack-plugin is removed. |
webpack/webpack-cli#276 (incorrect help display in webpack-cli) |
@sokra I wrote a simple webpack plugin to inject the JS assets into the html. I get the same error, this time in console:
Which turns in mode:production into:
It looks like some internal webpack function is missing from the bundle? |
Done: I was not excluding node_modules from babel transpilation. |
If you have to exclude node_modules/, how do you get babel to polyfill/transform code in 3rd party code? |
@SeanHayes you don't have to exclude all of |
See [Enable babel-preset-env for node_modules that target newer Node versions](facebook/create-react-app#1125) See [Create React App 2.0: "You can now use packages written for latest Node versions without breaking the build"](https://reactjs.org/blog/2018/10/01/create-react-app-v2.html) See ["If you have to exclude node_modules/, how do you get babel to polyfill/transform code in 3rd party code?"](webpack/webpack#6544 (comment)) See [Compile dependencies with babel-preset-env](facebook/create-react-app#3776)
See [Enable babel-preset-env for node_modules that target newer Node versions](facebook/create-react-app#1125) See [Create React App 2.0: "You can now use packages written for latest Node versions without breaking the build"](https://reactjs.org/blog/2018/10/01/create-react-app-v2.html) See ["If you have to exclude node_modules/, how do you get babel to polyfill/transform code in 3rd party code?"](webpack/webpack#6544 (comment)) See [Compile dependencies with babel-preset-env](facebook/create-react-app#3776)
See [Enable babel-preset-env for node_modules that target newer Node versions](facebook/create-react-app#1125) See [Create React App 2.0: "You can now use packages written for latest Node versions without breaking the build"](https://reactjs.org/blog/2018/10/01/create-react-app-v2.html) See ["If you have to exclude node_modules/, how do you get babel to polyfill/transform code in 3rd party code?"](webpack/webpack#6544 (comment)) See [Compile dependencies with babel-preset-env](facebook/create-react-app#3776)
@sokra is there any workaround if you have to include node_modules and transform code in 3rd party code? |
Sorry for hijacking this issue, but I ran into something similar when trying to run my Note: I do have the
|
@pleunv did you find a solution please ? i have the same error with |
|
What is the current behavior?
I'm trying to migrate from webpack@3 to webpack@4 with a simple config (https://github.com/damianobarbati/yarsk/blob/master/config/webpack.config.js) but I get:
The bundle analyzer shows that full
lodash-es
is included into the bundle and no tree shaking is happening.If the current behavior is a bug, please provide the steps to reproduce.
Here the full repro: https://github.com/damianobarbati/yarsk
Instructions in the README.
Basically just:
git clone https://github.com/damianobarbati/yarsk
yarn install
npm install -g pm2
yarn build:dev
Versions:
The text was updated successfully, but these errors were encountered: