Can't resolve 'window' in 'project/node_modules/jquery/dist'
See original GitHub issueBug report
Can't resolve 'window' in 'project/node_modules/jquery/dist'
Can't resolve 'var define = false' in 'project/node_modules/jquery/dist'
Actual Behavior
In webpack@5.68.0
+ imports-loader@3.1.1
can not work.
In webpack.config.js:
{
test: new RegExp(`(${regExp.join('|')})$`),
use: [
{
loader: 'imports-loader',
options: {
additionalCode: 'var define = false; var module = false; var exports = false;',
wrapper: 'window'
}
}
]
}
In webpack@4.41.2
+ imports-loader@0.8.0
normal work.
In webpack.config.js:
{
test: new RegExp(`(${regExp.join('|')})$`),
loader: 'imports-loader?define=>false&module=>false&exports=>false&this=>window',
}
Please paste the results of npx webpack-cli info
here, and mention other relevant information
System:
OS: macOS 12.0.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 595.60 MB / 8.00 GB
Binaries:
Node: 12.22.7 - ~/.nvm/versions/node/v12.22.7/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.1.3 - ~/.nvm/versions/node/v12.22.7/bin/npm
Browsers:
Chrome: 98.0.4758.80
Firefox: 95.0.2
Safari: 15.1
Packages:
es-webpack-engine: ^4.6.0 => 5.0.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Module not found: Error: Can't resolve 'jquery' in webpack #153
Hi, the message recommendation is that run de command npm install --save jquery, i run this command and the error was fixed, hope...
Read more >Module not found: Error: Can't resolve 'jquery' in - Stack Overflow
try installing jquery on npm, it should solve it. I had that issue on react.js.
Read more >How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
Author your app or library using ES2015 modules, then efficiently bundle them up into a single file for use in browsers and Node.js....
Read more >Externals - webpack
The externals configuration option provides a way of excluding dependencies from the output bundles. Instead, the created bundle relies on that dependency ...
Read more >Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
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
Solved this problem in other ways. Also thank you very much for the help you provided me. @alexander-akait
@Hongbusi Can you reduce complex of the reproducible? I still can’t run your example