-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
56 lines (55 loc) · 1.44 KB
/
webpack.common.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
const { resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
module.exports = {
context: resolve(__dirname, 'src'),
devtool: 'eval-cheap-module-source-map',
entry: {
app: ['./index.ts']
},
output: {
publicPath: '/',
filename: '[contenthash].bundle.js',
path: resolve(__dirname, 'dist')
},
watch: false,
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
"buffer": require.resolve("buffer")
}
},
plugins: [
new HtmlWebpackPlugin({
title: 'WebX',
inject: true,
template: 'index.html',
minify: false
}),
// Work around for Buffer is undefined:
// https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
]
};