forked from kisonecat/dvi2html
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
38 lines (36 loc) · 1.42 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
import path from 'path';
import ESLintPlugin from 'eslint-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
export default (_env, argv) => {
process.env.NODE_ENV = argv.mode ?? 'development';
return {
entry: { index: path.resolve(import.meta.dirname, './src/index.ts') },
output: {
filename: '[name].js',
path: path.resolve(import.meta.dirname, 'dist'),
library: { type: 'module' },
clean: true
},
experiments: { outputModule: true },
devServer: { static: './public' },
devtool: process.env.NODE_ENV === 'development' ? 'source-map' : false,
resolve: {
modules: ['node_modules'],
extensions: ['.ts', '.js'],
mainFields: ['browser', 'module', 'main'],
alias: { src: path.resolve(import.meta.dirname, 'src') }
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/ },
{ test: /\.ts$/, exclude: /node_modules/, use: [{ loader: 'ts-loader' }] }
]
},
plugins: [new ESLintPlugin({ configType: 'flat' })],
optimization: {
minimize: process.env.NODE_ENV === 'development' ? false : true,
minimizer: [new TerserPlugin({ terserOptions: { format: { comments: false } }, extractComments: false })]
},
performance: { hints: false }
};
};