-
-
Notifications
You must be signed in to change notification settings - Fork 87
/
webpack.config.js
59 lines (55 loc) · 1.22 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
55
56
57
58
59
/* eslint-disable @typescript-eslint/no-var-requires */
const Webpack = require('webpack')
const { version } = require('./package.json')
const config = {
mode: 'production',
devtool: 'source-map',
module: {
rules: [
// All files with a '.ts' extension will be handled by 'ts-loader'.
{ test: /\.ts$/, loader: 'ts-loader' },
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{ test: /\.js$/, loader: 'source-map-loader' },
],
},
resolve: {
extensions: ['.ts', '.js'],
modules: ['node_modules'],
},
plugins: [
new Webpack.BannerPlugin(
`Shifty ${version} - https://github.com/jeremyckahn/shifty`
),
new Webpack.DefinePlugin({
'process.env.PACKAGE_VERSION': JSON.stringify(
require('./package.json').version
),
}),
],
}
const output = {
library: 'shifty',
libraryTarget: 'umd',
umdNamedDefine: true,
}
module.exports = [
{
...config,
target: ['web', 'es5'],
output: {
...output,
filename: 'shifty.js',
},
},
{
...config,
target: 'node10',
output: {
...output,
filename: 'shifty.node.js',
},
optimization: {
minimize: false,
},
},
]