-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.ts
44 lines (42 loc) · 1.28 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
/**
* webpack.config.ts: Webpack configuration factory.
*/
import path from 'node:path';
import webpack from 'webpack';
export default (env: any, argv: any): webpack.Configuration => {
console.warn(`Webpack configuration path: ${__filename}\n- Building ${argv.mode} bundle.\n- Build environment variables:`);
console.table(env);
return {
mode: argv.mode,
entry: path.join(__dirname, 'src', 'lib.ts'),
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.build.json',
},
},
],
exclude: [/node_modules/, /lib/, /res/, /script/, /.*\.spec\.ts$/],
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
filename: 'mathjslab.js',
path: path.join(__dirname, 'lib'),
library: {
name: 'mathjslab',
type: 'umd',
},
clean: true,
globalObject: 'globalThis',
},
};
};