forked from kisonecat/tikzjax
-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
32 lines (29 loc) · 1.43 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
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
module.exports = (_env, argv) => {
process.env.NODE_ENV = argv.mode ?? 'development';
const config = {
entry: { tikzjax: './src/index.js', 'run-tex': './src/run-tex.js' },
output: { path: path.resolve(__dirname, 'dist'), filename: '[name].js' },
devServer: { static: path.join(__dirname, './public'), port: 9090 },
devtool: process.env.NODE_ENV === 'development' ? 'source-map' : false,
module: { rules: [{ test: /\.css$/, use: ['style-loader', 'css-loader'] }] },
performance: { hints: false },
plugins: [
new TerserPlugin({ terserOptions: { format: { comments: false } }, extractComments: false }),
new CopyPlugin({
patterns: [
{ from: './css/fonts.css', to: path.resolve(__dirname, 'dist') },
{ from: './core.dump.gz', to: path.resolve(__dirname, 'dist'), noErrorOnMissing: true },
{ from: './tex.wasm.gz', to: path.resolve(__dirname, 'dist'), noErrorOnMissing: true }
]
}),
new webpack.ProvidePlugin({ process: 'process/browser' }),
new ESLintPlugin({ configType: 'flat' })
]
};
return config;
};