-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.playground.js
49 lines (41 loc) · 1.21 KB
/
webpack.config.playground.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
45
46
47
48
49
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const path = require('path');
const common = require('./webpack.config.js');
const outputPath = path.resolve(__dirname, 'playground/output');
common.entry = {
script: './playground/playground.js',
};
common.devServer = {
static: {
directory: outputPath,
},
hot: true,
};
common.mode = 'development';
common.plugins = [
new MiniCssExtractPlugin({
filename: 'common.css',
}),
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [
{ from: 'playground/html/index.html', to: outputPath },
{ from: 'playground/html/styles.css', to: outputPath },
],
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.MOCKED_API': JSON.stringify('true'),
}),
new webpack.HotModuleReplacementPlugin(),
new ReactRefreshWebpackPlugin(),
];
common.output = {
path: outputPath,
filename: 'script.js',
};
module.exports = common;