blob: 6881c2558098fca7cd7b8bd399b1b9c414c11d29 [file] [log] [blame]
zorkowc1850b82021-05-10 21:57:37 +01001const path = require('path');
2const TerserPlugin = require('terser-webpack-plugin');
zorkow2b912ac2021-09-10 17:02:36 +02003const CircularDependencyPlugin = require('circular-dependency-plugin');
4
zorkowc1850b82021-05-10 21:57:37 +01005
6let config = {
7 module: {
8 rules: [
9 {
10 test: /\.tsx?$/,
11 use: 'ts-loader',
12 exclude: /node_modules|src/,
13 }
14 ],
15 },
16 resolve: {
17 extensions: [ '.tsx', '.ts', '.js' ],
18 },
19 node: {
20 __dirname: false
21 },
zorkow2b912ac2021-09-10 17:02:36 +020022 plugins: [
23 new CircularDependencyPlugin({
24 // exclude detection of files based on a RegExp
25 exclude: /a\.js|node_modules/,
26 // add errors to webpack instead of warnings
27 failOnError: false,
28 // allow import cycles that include an asyncronous import,
29 // e.g. via import(/* webpackMode: "weak" */ './file.js')
30 allowAsyncCycles: false,
31 // set the current working directory for displaying module paths
32 cwd: process.cwd(),
33 })
34 ],
zorkowc1850b82021-05-10 21:57:37 +010035 optimization: {
36 minimize: true,
37 minimizer: [new TerserPlugin({
38 terserOptions: {
39 output: {
40 ascii_only: true
41 }
42 }
43 })]
44 },
45 mode: 'production'
46};
47
48let sreConfig = Object.assign({}, config, {
49 entry: path.resolve(__dirname, 'ts/index.ts'),
50 // devtool: false,
51 // target: 'web',
52 output: {
53 filename: 'sre.js',
54 library: 'SRE',
55 libraryTarget: 'umd',
56 globalObject: 'this',
57 path: path.join(__dirname, 'lib'),
58 }
59});
60
zorkowfb546952021-05-19 11:53:22 +010061let mjConfig = Object.assign({}, config, {
62 entry: path.resolve(__dirname, 'ts/common/mathjax.ts'),
63 // devtool: false,
64 target: 'web',
65 output: {
66 filename: 'mathjax-sre.js',
67 library: 'MJ',
68 libraryTarget: 'umd',
69 globalObject: 'this',
70 path: path.join(__dirname, 'lib'),
71 }
72});
73
zorkowc1850b82021-05-10 21:57:37 +010074module.exports = [sreConfig];