webpack.dll.config.js:
entry: {
vendor: [
'jquery',
'swiper'
]
},
output: {
path: path.join(__dirname, 'dist', 'dev'),
filename: '[name].dll.js',
library: '[name]_library'
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, 'dist', 'dev', '[name]-manifest.json'),
name: '[name]_library'
})
]
webpack.config.js:
plugins:[
new ExtractTextPlugin("css/[name]/[name].css"),
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./dist/dev/vendor-manifest.json')
}),
html中引入vendor.js:
</div>
<script src="dev/vendor.dll.js"></script>
<script type="text/javascript" src="js/resList/resList.js"></script></body>
</html>
并且编译了dll文件,也build好了没有报错,reslist.js文件里有用到jquery,但是浏览器上面报错:$ is not defined
请问是不是我漏了什么步骤?该怎么解决?
这个文件生成好了么