-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
75 lines (73 loc) · 1.88 KB
/
webpack.config.ts
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
import path from 'path';
import { Configuration, DefinePlugin } from 'webpack';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
const webpackConfig = (): Configuration => ({
entry: './src/index.ts',
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js'],
plugins: [
// eslint-disable-next-line @typescript-eslint/no-explicit-any
new TsconfigPathsPlugin({ configFile: './tsconfig.json' }) as any,
],
},
bail: true,
output: {
path: path.join(__dirname, '/dist'),
filename: 'index.js',
sourceMapFilename: 'index.js.map',
clean: true,
libraryTarget: 'umd',
umdNamedDefine: true,
},
optimization: {
minimize: false,
splitChunks: false,
},
module: {
rules: [
{
test: /\.svg/,
type: 'asset/inline',
},
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
onlyCompileBundledFiles: true,
},
exclude: /node_modules|\.d\.ts$/,
},
{
test: /\.s[ac]ss$/i,
use: [
{
loader: 'style-loader',
options: { injectType: 'singletonStyleTag' },
},
{
loader: 'css-loader',
options: {
importLoaders: 1,
},
},
'sass-loader',
],
},
],
},
plugins: [
// DefinePlugin allows you to create global constants which can be configured at compile time
new DefinePlugin({
'process.env': process.env.production || !process.env.development,
}),
new ForkTsCheckerWebpackPlugin({
// Speeds up TypeScript type checking and ESLint linting (by moving each to a separate process)
eslint: {
files: './src/**/*.{ts,tsx,js,jsx}',
},
}),
],
});
export default webpackConfig;