-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
44 lines (39 loc) · 1.03 KB
/
webpack.config.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
const fs = require('fs');
const path = require('path');
const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');
const projectPath = path.resolve(fs.realpathSync(process.cwd()), '.');
const packagesPath = path.resolve(fs.realpathSync(process.cwd()), 'packages');
const config = {
mode: process.env.NODE_ENV,
module: {
rules: [
// Transform ES6 with Babel
{
test: /\.(js|jsx|mjs)$/,
include: [projectPath],
use: [
{
loader: require.resolve('babel-loader'),
options: {
babelrc: true,
cacheDirectory: true,
presets: [],
},
},
],
},
],
},
optimization: {
minimize: false,
},
plugins: [],
resolve: {
modules: ['node_modules'],
extensions: ['.mjs', '.jsx', '.js', '.json'],
},
};
if (process.env.NODE_ENV === 'production' && !process.env.DISABLE_PEER_DEPS_PLUGIN) {
config.plugins.push(new PeerDepsExternalsPlugin());
}
module.exports = config;