zorkow | c1850b8 | 2021-05-10 21:57:37 +0100 | [diff] [blame^] | 1 | const path = require('path'); |
| 2 | const TerserPlugin = require('terser-webpack-plugin'); |
| 3 | |
| 4 | let config = { |
| 5 | module: { |
| 6 | rules: [ |
| 7 | { |
| 8 | test: /\.tsx?$/, |
| 9 | use: 'ts-loader', |
| 10 | exclude: /node_modules|src/, |
| 11 | } |
| 12 | ], |
| 13 | }, |
| 14 | resolve: { |
| 15 | extensions: [ '.tsx', '.ts', '.js' ], |
| 16 | }, |
| 17 | node: { |
| 18 | __dirname: false |
| 19 | }, |
| 20 | devtool: 'source-map', |
| 21 | optimization: { |
| 22 | minimize: true, |
| 23 | minimizer: [new TerserPlugin({ |
| 24 | terserOptions: { |
| 25 | output: { |
| 26 | ascii_only: true |
| 27 | } |
| 28 | } |
| 29 | })] |
| 30 | }, |
| 31 | mode: 'production' |
| 32 | }; |
| 33 | |
| 34 | let sreConfig = Object.assign({}, config, { |
| 35 | entry: path.resolve(__dirname, 'ts/index.ts'), |
| 36 | // devtool: false, |
| 37 | // target: 'web', |
| 38 | output: { |
| 39 | filename: 'sre.js', |
| 40 | library: 'SRE', |
| 41 | libraryTarget: 'umd', |
| 42 | globalObject: 'this', |
| 43 | path: path.join(__dirname, 'lib'), |
| 44 | } |
| 45 | }); |
| 46 | |
| 47 | module.exports = [sreConfig]; |