-
Notifications
You must be signed in to change notification settings - Fork 18
/
webpack.config.js
49 lines (44 loc) · 1.18 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
45
46
47
48
49
const path = require('path');
const fs = require('fs');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const DEMO_SRC_DIR = path.resolve(__dirname, 'src/demos/');
const DEMO_DEST_DIR = path.resolve(__dirname, 'dist/demos/');
const demoFiles = fs.readdirSync(DEMO_SRC_DIR).map(function(filename) {
return {
template: path.resolve(DEMO_SRC_DIR, filename),
filename: path.resolve(DEMO_DEST_DIR, filename),
inject: 'head',
};
});
module.exports = {
entry: './src/index.js',
mode: 'production',
// mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'stixview.bundle.js',
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
],
},
{
test: /\.svg$/,
loader: 'svg-inline-loader',
},
],
},
watch: false,
// watch: true,
optimization: {
minimize: true,
},
plugins: demoFiles.map(function(details) {
return new HtmlWebpackPlugin(details);
}),
};