webpack / docs

[OLD] documentation for webpack
http://webpack.github.io/docs/
1.46k stars 127 forks source link

can DllPlugin and DllReferencePlugin run in browser by use the style of 'commonjs2' instead of 'insert a script tag in html' ? #89

Open klouskingsley opened 7 years ago

klouskingsley commented 7 years ago

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

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' }) ] }

captain-yossarian commented 6 years ago

Does somebody find solution here?

yousefallaban commented 5 years ago

I had the same error 🤔