-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.config.js
More file actions
69 lines (68 loc) · 1.68 KB
/
Copy pathwebpack.config.js
File metadata and controls
69 lines (68 loc) · 1.68 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const BundleAnalyzerPlugin =
require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
mode: 'production',
entry: {
options: './src/options.js',
popup: './src/popup.js',
onEnterProblem: './src/onEnterProblem.js',
onEnterProblemSet: './src/onEnterProblemSet.js',
background: './src/background.js',
editorEvent: './src/editorEvent.js',
},
output: {
filename: '[name].js',
path: __dirname + '/dist',
},
devtool: 'inline-source-map',
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
filename: 'options.html',
template: 'public/options.html',
chunks: ['options'],
}),
new HtmlWebpackPlugin({
filename: 'popup.html',
template: 'public/popup.html',
chunks: ['popup'],
}),
new CopyWebpackPlugin([
{from: 'public/images', to: 'images'},
{from: 'manifest.json', to: 'manifest.json'},
]),
new BundleAnalyzerPlugin(),
],
module: {
rules: [
{
test: /\.css$/,
use: [
{loader: 'style-loader'},
{loader: 'css-loader'},
],
},
{
test: /\.less$/,
use: [
{loader: 'style-loader'},
{loader: 'css-loader'},
{loader: 'less-loader'},
],
},
{
test: [/\.js$/, /\.jsx$/],
exclude: /node_modules/,
use: ['babel-loader'],
},
],
},
watchOptions: {
aggregateTimeout: 300,
poll: 5000,
ignored: /node_modules/,
},
};