-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwebpack.config.js
47 lines (42 loc) · 1.02 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
44
45
46
47
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const babelOptions = require('./babel.config')
const { NODE_ENV } = process.env
const mode = NODE_ENV || 'development'
const testConfig = {
mode,
context: path.join(__dirname, 'test-functional'),
entry: './test-pre-build.js',
output: {
path: path.join(__dirname, 'test-functional'),
filename: 'test-build.js',
},
}
const prodConfig = {
mode,
context: path.join(__dirname, 'lib'),
entry: './index.ts',
output: {
path: path.join(__dirname, 'dist'),
filename: 'vcard-creator.js',
library: 'vcardcreator',
libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this",
},
resolve: {
extensions: ['.js', '.ts'],
},
module: {
rules: [
{
test: /\.(j|t)s$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: babelOptions,
},
},
],
},
}
module.exports = mode === 'development' ? testConfig : prodConfig