Building webpack vendor dll and getting
Uncaught ReferenceError: vendors_9a2b8ee29a9e8dcdc486b49a360b9763 is not defined
The compiled code is coming out as
module.exports = vendors_9a2b8ee29a9e8dcdc486b49a360b9763;
//////////////////
// WEBPACK FOOTER
// external "vendors_9a2b8ee29a9e8dcdc486b49a360b9763"
// module id = 2
// module chunks = 0
it is missing the declaration and locating of something like
var angular = __webpack_require__(2)
module.exports = (__webpack_require__(3))(1)
I have no idea why this is and I've tried absolutely everything. Here is the plugins for my webpack config:
plugins: [
new webpack.DllReferencePlugin({
context: '.',
manifest: require('./src/tmp/vendors-manifest.json')
}),
],
and here is my dll config:
var webpack = require('webpack');
var packageJSON = require('./package.json');
var path = require('path');
module.exports = {
entry: {
vendors: Object.keys(packageJSON.devDependencies),
},
output: {
path: path.join(__dirname, 'src/tmp'),
filename: 'vendors.bundle.js',
library: 'vendors_[hash]'
},
plugins: [
new webpack.DllPlugin({
path: 'src/tmp/[name]-manifest.json',
name: 'vendors_[hash]'
}),
]
};
index.html imports:
<script type="text/javascript" src="/src/tmp/vendors.bundle.js"></script>
<script type="text/javascript" src="/dist/js/app.js"></script>
Any ideas would be greatly appreciated! Thanks ahead of time!
I had this problem. it solved by changing the context.
plugins: [
new webpack.DllReferencePlugin({
context: path.join(__dirname, 'src/tmp'),
manifest: require('./src/tmp/vendors-manifest.json')
})]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With