forked from MikaAK/angular-safeguard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
53 lines (45 loc) · 1.17 KB
/
webpack.config.babel.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
import path from 'path'
import {DefinePlugin} from 'webpack'
import {devDependencies} from './package.json'
const CONTEXT = path.resolve(__dirname),
{NODE_ENV} = process.env,
IS_DEV = NODE_ENV === 'development',
IS_TEST = NODE_ENV === 'test',
createPath = (nPath) => path.resolve(CONTEXT, nPath),
SRC_PATH = createPath('src'),
NODE_MODULES_PATH = createPath('node_modules')
var config = {
context: CONTEXT,
entry: './src/index.ts',
devtool: IS_TEST ? '#inline-source-map' : false,
output: {
path: createPath('dist'),
library: 'angular2-locker',
libraryTarget: 'umd',
filename: 'locker.js'
},
plugins: [
new DefinePlugin({
__DEV__: IS_DEV || IS_TEST
})
],
module: {
loaders: [{
test: /\.ts/,
loader: 'babel!ts',
include: [SRC_PATH, createPath('test')],
exclude: [NODE_MODULES_PATH]
}, {
test: /\.js/,
loader: 'babel',
include: [createPath('karma-shim')],
exclude: [NODE_MODULES_PATH]
}]
},
externals: IS_TEST ? [] : Object.keys(devDependencies),
resolve: {
extensions: ['.ts', '.js',''],
root: SRC_PATH
}
}
module.exports = config