-
Notifications
You must be signed in to change notification settings - Fork 213
/
webpack.config.js
42 lines (40 loc) · 1.08 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
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-state.js',
path: resolve(__dirname, 'dist'),
library: { type: 'system' },
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.m?(js|ts|tsx)$/,
exclude: /node_modules/,
use: 'swc-loader',
},
],
},
externals: Object.keys(peerDependencies || {}),
resolve: {
extensions: ['.ts', '.js', '.tsx', '.jsx'],
},
plugins: [
new CleanWebpackPlugin(),
new ForkTsCheckerWebpackPlugin(),
new BundleAnalyzerPlugin({
analyzerMode: env && env.analyze ? 'static' : 'disabled',
}),
],
devServer: {
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
},
});