forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
31 lines (29 loc) · 1.17 KB
/
webpack.config.js
File metadata and controls
31 lines (29 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
module.exports = ({ webpack }) => {
console.log(`Webpack version: ${webpack.version}`);
const localWebpack = require.resolve('webpack');
const bundledWebpack = require.resolve('webpack', {
paths: [require.resolve('@rushstack/heft-webpack5-plugin')]
});
const localWebpackInstance = require(localWebpack);
const bundledWebpackInstance = require(bundledWebpack);
if (localWebpack === bundledWebpack || localWebpackInstance === bundledWebpackInstance) {
throw new Error('Webpack versions match between bundled and local, cannot test rig loading.');
}
if (webpack.version !== localWebpackInstance.version) {
throw new Error('Webpack is not the same version as the local installation');
}
// Verify that the Compiler instances match the local version.
if (webpack.Compiler !== localWebpackInstance.Compiler) {
throw new Error('Webpack instances do not match the local installation');
}
if (webpack.Compiler === bundledWebpackInstance.Compiler) {
throw new Error('Received webpack instance is the same as the bundled version');
}
return {
mode: 'development',
entry: {
'test-bundle': `${__dirname}/lib/index.js`
}
};
};