forked from OpenGeoscience/geojs
-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack-tutorials.config.js
64 lines (58 loc) · 1.36 KB
/
webpack-tutorials.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const WebpackStringReplacer = require('webpack-string-replacer');
var TerserPlugin = require('terser-webpack-plugin');
var path = require('path');
var base = require('./webpack.config');
var rules = base.module.rules.concat([{
test: /\.pug$/,
use: ['pug-load']
}, {
test: /\.(woff|woff2|eot|ttf|svg)(\?v=\d+\.\d+\.\d+)?$/,
type: 'asset/inline'
}, {
test: require.resolve('codemirror'),
use: [{
loader: 'expose-loader',
options: {exposes: 'CodeMirror'}
}]
}]);
var plugins = base.plugins;
plugins.push(new WebpackStringReplacer({
rules:[{
fileInclude: /bootstrap.css$/,
replacements: [{
pattern: /@import.*fonts.googleapis.com\/css\?family=Lato[^;]*;/g,
replacement: () => '@import url(../../typeface-lato/index.css);'
}]
}]
}));
var resolve = {
extensions: ['.js', '.css', '.pug', '...'],
alias: base.resolve.alias
};
module.exports = {
mode: 'production',
performance: {hints: false},
devtool: 'source-map',
context: path.join(__dirname),
entry: {
bundle: './tutorials/index.js'
},
output: {
path: path.join(__dirname, 'dist', 'tutorials'),
publicPath: '/tutorials/',
filename: '[name].js'
},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
parallel: true
})
]
},
module: {
rules: rules
},
resolve: resolve,
plugins: plugins
};