forked from williamngan/pts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
54 lines (42 loc) · 1.3 KB
/
webpack.dev.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
var webpack = require('webpack');
var path = require('path');
var TARGET = process.env.npm_lifecycle_event
process.env.BABEL_ENV = TARGET
var APP_PATH = path.resolve(__dirname, 'src/_app.ts')
var LIB_PATH = path.resolve(__dirname, 'src/_lib.ts')
var BUILD_PATH = path.resolve(__dirname, 'dist')
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
pts: LIB_PATH
// testapp: APP_PATH
},
output: {
library: 'Pts',
libraryTarget: 'umd',
path: BUILD_PATH,
filename: 'pts.js',
globalObject: 'this'
},
devtool: 'source-map',
watchOptions: { poll: true }, // seems to need this for Windows Linux subsystem to watch
resolve: {
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
module: {
rules:[
{
test: /\.tsx?$/, loader: "tslint-loader", enforce: "pre",
options: {emitErrors: true, failOnHint: true}
},
{
test: /\.tsx?$/,
loader: '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.` )
]
};