-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
52 lines (50 loc) · 1.54 KB
/
webpack.config.js
File metadata and controls
52 lines (50 loc) · 1.54 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
var path = require('path');
var webpack = require('webpack');
var vtkRules = require('vtk.js/Utilities/config/dependency.js').webpack.core.rules;
var cssRules = require('vtk.js/Utilities/config/dependency.js').webpack.css.rules;
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
var entry = path.join(__dirname, './src/index.js');
const sourcePath = path.join(__dirname, './src');
const outputPath = path.join(__dirname, './dist');
module.exports = {
entry,
output: {
path: outputPath,
filename: 'index_bundle.js'
},
module: {
rules: [
{ test: /\.html$/, loader: 'html-loader' },
{ test: /\.(png|jpg)$/, use: 'url-loader' },
{ test: /\.svg$/, use: [{ loader: 'raw-loader' }] }
].concat(vtkRules, cssRules)
},
resolve: {
modules: [
path.resolve(__dirname, 'node_modules'),
sourcePath
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html',
inlineSource: '.(js|css)$',
inject: true,
minify: {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true
}
}),
new HtmlWebpackInlineSourcePlugin(HtmlWebpackPlugin),
new CleanWebpackPlugin({
protectWebpackAssets: false,
cleanAfterEveryBuildPatterns: ['*.js']
})
]
};