-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
65 lines (62 loc) · 1.88 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const ESLintPlugin = require('eslint-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = (env, options) => {
let modePlugins = [];
if (options.mode === 'development') {
modePlugins = [
new HtmlWebpackPlugin({ template: './public/index.html', filename: 'index.html' })
];
}
return {
entry: './src/index.ts',
mode: 'production',
target: 'web',
plugins: [
new ESLintPlugin({ extensions: ['ts', 'js', 'tsx', 'jsx'] }),
...modePlugins
],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.(scss|css)$/,
exclude: /node_modules/,
use: [
'sass-to-string',
{
loader: 'sass-loader',
options: {
sassOptions: {
outputStyle: 'compressed'
}
}
}
]
},
{
test: /\.svg$/,
exclude: /node_modules/,
use: 'svg-url-loader'
}
]
},
devServer: {
port: 3000,
static: path.join(__dirname, 'dist')
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.scss']
},
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'lib'),
libraryTarget: 'umd'
}
};
};