This repository was archived by the owner on Aug 8, 2019. It is now read-only.
This repository was archived by the owner on Aug 8, 2019. It is now read-only.
can DllPlugin and DllReferencePlugin run in browser by use the style of 'commonjs2' instead of 'insert a script tag in html' ? #89
Open
Description
I try to use commonjs2 style in DllPlugin and the browser return an error
Uncaught ReferenceError: require is not defined
here is my config files
- webpack dll config
var webpack = require('webpack')
module.exports = {
output: {
path: './dll',
filename: '[name].js',
library: '[name]',
libraryTarget: 'commonjs2'
},
entry: {
test: ['./js/lib/browser.js']
},
plugins: [
new webpack.DllPlugin({
path: './dll/[name]-manifest.json',
name: '[name]',
context: __dirname
})
]
}
- webpack config fle
var webpack = require('webpack')
module.exports = {
output: {
path: __dirname,
filename: '[name].bundle.js',
},
entry: {
app: ['./app.js']
},
plugins: [
new webpack.DllReferencePlugin({
manifest: require('./dll/test-manifest.json'),
context: __dirname,
sourceType: 'commonjs2',
name: './dll/test.js'
})
]
}
Metadata
Metadata
Assignees
Labels
No labels