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