forked from okta/okta-auth-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.config.js
54 lines (51 loc) · 1.2 KB
/
webpack.common.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
44
45
46
47
48
49
50
51
52
53
54
// This is the base webpack config that other configs build upon
var webpack = require('webpack');
var SDK_VERSION = require('./package.json').version;
var babelOptions = {
presets: ['@babel/preset-env'],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime'
],
sourceType: 'unambiguous',
// the banners should only be added at the end of the build process
// ignore all comments during transpiling
shouldPrintComment: () => false
};
var babelExclude = /node_modules\/(?!p-cancelable)/;
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: babelExclude,
loader: 'babel-loader',
options: babelOptions
},
{
test: /\.ts$/,
exclude: babelExclude,
use: [
{
loader: 'babel-loader',
options: babelOptions
},
{
loader: 'ts-loader'
}
]
}
]
},
resolve: {
extensions: ['.js', '.ts'],
alias: {
'./node$': './browser', // use browser built-in objects and functions
}
},
plugins: [
new webpack.DefinePlugin({
SDK_VERSION: JSON.stringify(SDK_VERSION)
})
]
};