-
Notifications
You must be signed in to change notification settings - Fork 213
/
webpack.config.js
43 lines (41 loc) · 1.11 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
33
34
35
36
37
38
39
40
41
42
43
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const { resolve } = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { peerDependencies } = require('./package.json');
module.exports = (env) => ({
entry: [resolve(__dirname, 'src/index.ts')],
output: {
filename: 'openmrs-esm-error-handling.js',
path: resolve(__dirname, 'dist'),
library: { type: 'system' },
},
mode: 'production',
module: {
rules: [
{
test: /\.m?(js|ts|tsx)$/,
exclude: /node_modules/,
use: 'swc-loader',
},
],
},
devtool: 'source-map',
devServer: {
headers: {
'Access-Control-Allow-Origin': '*',
},
disableHostCheck: true,
},
externals: Object.keys(peerDependencies || {}),
plugins: [
new ForkTsCheckerWebpackPlugin(),
new CleanWebpackPlugin(),
new BundleAnalyzerPlugin({
analyzerMode: env && env.analyze ? 'static' : 'disabled',
}),
],
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js'],
},
});