imports-loader 配置this指向问题
来源:4-11 Shimming 的作用
慕粉1034061341
2020-08-04
{
test: /.js/,
exclude: /node_modules/,
use: [
{
loader: ‘babel-loader’
},
{
loader: ‘imports-loader’,
options: {
imports: {
moduleName: ‘jquery’,
name: ‘$’
},
wrapper: {
thisArg: ‘window’
}
}
}
]
},
webpack: 4.43.0, “imports-loader”: "^1.1.0"
按照最新文档配置this指向window一直不生效,报错如下
ERROR in ./src/index.js
Module build failed (from ./node_modules/imports-loader/dist/cjs.js):
TypeError: Cannot read property ‘join’ of undefined
at Object.loader (/Users/zml/Documents/code/TestWebpack/4-9shimming垫片/node_modules/imports-loader/dist/index.js:71:19)
麻烦导师看下
写回答
1回答
-
Dell
2020-08-06
新版好像就不支持这个配置了,不要用了
00
相似问题