forked from williamngan/pts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.es5.js
82 lines (70 loc) · 1.69 KB
/
webpack.es5.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* webpack.es5.js
*/
var webpack = require('webpack');
var path = require('path');
var LIB_PATH = path.resolve(__dirname, 'src/_module.ts')
var BUILD_PATH = path.resolve(__dirname, 'dist')
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
pts: LIB_PATH
},
output: {
libraryTarget: 'umd',
umdNamedDefine: true,
path: BUILD_PATH,
filename: 'es5.js',
globalObject: 'this'
},
// watchOptions: { poll: true }, // seems to need this for Windows Linux subsystem to watch
resolve: {
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
module: {
rules:[
/*
* Lintint
*/
{
test: /\.tsx?$/,
loader: 'tslint-loader',
enforce: 'pre',
options: {
emitErrors: true,
failOnHint: true
}
},
/*
* Transpiling
* Files are passed to ts-loader first, then babel-loader
*/
{
test: /\.tsx?$/,
loader: [
{
loader: 'babel-loader',
options: {
presets: ['env'],
plugins: [
[
'babel-plugin-transform-builtin-extend', {
globals: ['Array', 'Float32Array'],
approximate: false
}
]
]
}
},
'ts-loader',
]
},
],
},
plugins: [
new webpack.BannerPlugin(
`pts.js ${require('./package.json').version} - Copyright © 2017-${new Date().getFullYear()} William Ngan and contributors.\nLicensed under Apache 2.0 License.\nSee https://github.com/williamngan/pts for details.`
)
]
};