-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
45 lines (39 loc) · 1.08 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
const path = require('path');
const fs = require('fs');
const CleanWebpackPlugin = require('clean-webpack-plugin');
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',
}
})
let plugins = demoFiles.map(function(details) {
return new HtmlWebpackPlugin(details)
});
plugins.unshift(new CleanWebpackPlugin());
module.exports = {
entry: './src/main.js',
mode: 'production',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'prettier-elastic-query.min.js',
},
optimization: {
minimize: true
},
module: {
rules:[
{
test: /\.css$/,
use: [
'style-loader', 'css-loader'
],
},
]
},
plugins: plugins,
};