forked from hax0r31337/pack-essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
62 lines (61 loc) · 1.77 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
50
51
52
53
54
55
56
57
58
59
60
61
62
const HtmlWebpackPlugin = require('html-webpack-plugin');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
resolve: {
modules: ['src', 'node_modules']
},
devtool: false,
entry: {
vendor: ['@babel/polyfill', 'react', 'react-dom'],
client: './src/index.js',
},
output: {
path: __dirname + '/dist',
filename: '[name].[contenthash].js',
chunkFilename: '[name].[contenthash].js',
publicPath: '/',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.css$/i,
exclude: /node_modules/,
use: ['style-loader', 'css-loader', 'postcss-loader']
},
]
},
devServer: {
historyApiFallback: true
},
plugins: [
new HtmlWebpackPlugin({
title: 'EncryptMyPack-OSS',
template: './src/index.html',
filename: './index.html',
inject: true,
minify: {
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
minifyCSS: true,
minifyURLs: true,
minifyJS: true,
removeComments: true,
removeRedundantAttributes: true
}
}),
new AddAssetHtmlPlugin({ filepath: require.resolve('./wasm/build/wasm_exec.js') }),
new CopyWebpackPlugin({
patterns: [
{ from: './wasm/build/libresourcepack.wasm', to: './' }
]
})
]
};