-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
38 lines (36 loc) · 1010 Bytes
/
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
//@ts-check
const path = require('path');
const LicensePlugin = require('webpack-license-plugin').default;
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
// const fs = require('fs');
// const licenseText = fs.readFileSync(path.resolve(__dirname, './LICENSE'), 'utf8');
// const licenseText = 'numpy-js - copyright 2023 Carlos Pinzón <caph1993@gmail.com>';
module.exports = {
module: {
rules: [
{
test: /\.ts?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
publicPath: '',
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'umd', // Fix: "Uncaught ReferenceError: exports is not defined".
},
plugins: [
new LicensePlugin(),
// new webpack.BannerPlugin({ banner: licenseText, raw: true }),
],
devtool: 'source-map',
optimization: {
minimizer: [new UglifyJsPlugin({ sourceMap: true })],
},
mode: "production",
};