Skip to content

Instantly share code, notes, and snippets.

@nemtsov
Last active August 31, 2017 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemtsov/b1df26c3ed6025879590e34c399f9f2a to your computer and use it in GitHub Desktop.
Save nemtsov/b1df26c3ed6025879590e34c399f9f2a to your computer and use it in GitHub Desktop.
Sample webpack configuration to demonstrate a non-descriptive error message for an incorrect "dependencies"
module.exports = {
context: `${__dirname}/../js`,
output: {
pathinfo: true,
filename: '[name].js',
path: `${__dirname}/../dist`
}
};
const merge = require('webpack-merge');
const webpack = require('webpack');
const base = require('./_base');
const path = require('path');
module.exports = merge(base, {
dependencies: ['common'],
entry: {
'a': ['./common', './a'],
},
plugins: [
new webpack.DllReferencePlugin({
manifest: path.resolve(base.output.path, 'common.manifest.json'),
}),
],
});
const merge = require('webpack-merge');
const webpack = require('webpack');
const base = require('./_base');
const path = require('path');
module.exports = merge(base, {
name: 'common',
entry: ['./common'],
output: {
filename: 'common.js',
},
plugins: [
new webpack.DllPlugin({
path: path.resolve(base.output.path, 'common.manifest.json'),
}),
],
});
console.log('a');
__webpack_public_path__ = "https://cdn.example.com/x3ad76/js"
const base = require('./build/_base');
const common = require('./build/common');
const a = require('./build/a');
module.exports = [
// common,
a,
];
@nemtsov
Copy link
Author

nemtsov commented Aug 31, 2017

Note: put the build_ prefixed files in the /build folder and js_ prefixed ones in the js folder. npm install webpack webpack-merge and ./node_modules/.bin/webpack --verbose. You'll get: Cannot read property 'hash' of null as the only output in webpack 3.5.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment