-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwebpack.config.js
90 lines (88 loc) · 2.05 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
// We need to enumerate all sass files because we aren't importing the sass
// files from the Javascript (and therefore Webpack doesn't know about them
// unless they're explicitly declared as entrypoints).
SASS_SRC_DIR = './src/client/styles/';
const sassSrcFiles = fs.readdirSync(SASS_SRC_DIR)
.filter(name => name.match(/^[^_].*\.scss$/))
.map(name => SASS_SRC_DIR + name);
module.exports = [{
target: "web",
mode: 'development',
devtool: 'source-map',
entry: sassSrcFiles.concat([
'./src/client/main.tsx',
]),
output: {
path: path.resolve(__dirname, 'dist', 'client'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js(x?)$/,
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader'],
}, {
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: ['ts-loader', 'eslint-loader'],
}, {
test: /\.scss$/,
use: [
{
loader: 'file-loader',
options: { name: 'css/[name].css' }
},
{ loader: 'sass-loader' },
]
}, {
test: /\.svg$/,
use: [{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: {
removeViewBox: false,
},
},
},
}],
},
]
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
],
devServer: {
contentBase: './dist',
hot: true,
},
//}, {
// target: "node",
// mode: 'development',
// entry: [
// './src/server/index.js'
// ],
// output: {
// path: path.resolve(__dirname, 'dist', 'server'),
// filename: 'bundle.js'
// },
// module: {
// rules: [
// {
// test: /\.js$/,
// exclude: /node_modules/,
// use: 'babel-loader'
// }
// ]
// },
// externals: {
// uws: "uws"
// },
}]