-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
54 lines (49 loc) · 1.26 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
48
49
50
51
52
53
54
const webpack = require('webpack')
const path = require('path')
const package = require('./package.json')
const version = JSON.stringify(package.version)
const plugins = [
new webpack.BannerPlugin({
banner:
`@license Urpflanze v${version}` +
`\n[file]` +
`\n\nGithub: https://github.com/urpflanze-org/core` +
`\n\nThis source code is licensed under the MIT license found in the\nLICENSE file in the root directory of this source tree.`,
}),
]
const umd = bProduction => ({
entry: {
urpflanze: './dist/cjs/index.js',
},
output: {
filename: bProduction ? 'urpflanze.min.js' : 'urpflanze.js',
path: path.resolve('./build/umd'),
library: {
name: 'Urpflanze',
type: 'umd',
},
globalObject: 'window',
},
plugins,
devtool: bProduction ? undefined : 'source-map',
mode: bProduction ? 'production' : 'none',
})
const esm = bProduction => ({
entry: {
urpflanze: './dist/esm/index.js',
},
output: {
filename: bProduction ? 'urpflanze.min.js' : 'urpflanze.js',
path: path.resolve('./build/esm'),
library: {
type: 'module',
},
},
plugins,
devtool: bProduction ? undefined : 'source-map',
mode: bProduction ? 'production' : 'none',
experiments: {
outputModule: true,
},
})
module.exports = [umd(false), umd(true), esm(false), esm(true)]