This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
60 lines (56 loc) · 1.77 KB
/
webpack.config.ts
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { setup } from './src/auto-generated'
import * as path from 'path'
import * as webpack from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
const ROOT = path.resolve(__dirname, 'src')
const DESTINATION = path.resolve(__dirname, 'dist')
const webpackConfig: webpack.Configuration = {
resolve: {
extensions: ['.ts', 'tsx', '.js'],
modules: [ROOT, 'node_modules'],
fallback: {
url: require.resolve('url/'),
fs: false,
tls: false,
net: false,
path: false,
zlib: false,
http: false,
https: false,
stream: false,
crypto: false,
'crypto-browserify': require.resolve('crypto-browserify'), //if you want to use this module also don't forget npm i crypto-browserify
},
},
context: ROOT,
entry: setup.entries,
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: './bundle-analysis.html',
openAnalyzer: false,
}),
],
output: {
path: DESTINATION,
publicPath: `/api/assets-gateway/raw/package/${setup.assetId}/${setup.version}/dist/`,
libraryTarget: 'umd',
umdNamedDefine: true,
library: `[name]_APIv${setup.apiVersion}`,
devtoolNamespace: `${setup.name}_APIv${setup.apiVersion}`,
filename: '[name].js',
globalObject: `(typeof self !== 'undefined' ? self : this)`,
},
externals: setup.externals,
module: {
rules: [
{
test: /\.ts$/,
use: [{ loader: 'ts-loader' }],
exclude: /node_modules/,
},
],
},
devtool: 'source-map',
}
export default webpackConfig