Not working with Karma and Webpack 4
See original GitHub issueHi,
I’ve a strange bug. All works correctly when I run my application in production, but I can’t run my unit tests because of your module… Removing all require('iconv-lite')
in my code resolve the problem.
I’m using Webpack 4, Karma 3, ES6.
This is the error I get:
Electron 3.0.2 (Node 10.2.0) ERROR
{
"message": "Uncaught TypeError: __webpack_require__(...) is not a function\nat webpack:///app/node_modules/iconv-lite/lib/index.js:144:27 <- index.js:58520:48\n\nundefined",
"str": "Uncaught TypeError: __webpack_require__(...) is not a function\nat webpack:///app/node_modules/iconv-lite/lib/index.js:144:27 <- index.js:58520:48\n\nundefined"
}
Have you any Idea of what this could be ? Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:29 (9 by maintainers)
Top Results From Across the Web
Autowatch not working with karma-webpack on karma version ...
Fix. Downgrade Karma to 3.1.4 version fixed the problem.
Read more >Can anyone provide a webpack4 & Karma configuration that ...
I recently upgraded to Webpack4 and I am running into issues where karma start will run my webpack build and then do nothing....
Read more >karma-webpack - npm
Start using karma-webpack in your project by running `npm i karma-webpack`. ... karma-webpack. 4.0.0-rc.6 • Public • Published 4 years ago.
Read more >TypeScript starter project w/ Webpack 4, Karma, Jasmine
This tutorial showcases a starter project for people who want to use TypeScript w/ a stater project already setup to deploy to browsers ......
Read more >KJS: Resources are not available when running Karma tests
The core of the issue seems to be that during development, files from the resources directory are served by webpack-dev-server, while during Karma...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As @Feverqwe said in #205 : adding
to the webpack
module.rules
solve my problem. Thanks for the workaround !But I think that @whitehat101 PR #203 is a better solution and hope it will be merged soon.
I ran into the same issue in an electron environment (using vue-cli-plugin-electron-builder).
I believe the problem originates from these configurations:
__webpack_require__(...) is not a function
error because streams.js is never bundled.