forked from benmarch/angular-ui-tour
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
81 lines (78 loc) · 2.3 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
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
'use strict';
//IMPORTS
const path = require('path'),
webpack = require('webpack'),
CleanPlugin = require('clean-webpack-plugin'),
nodeExternals = require('webpack-node-externals'),
bowerExternals = require('webpack-bower-externals'),
moduleName = 'bm.uiTour',
libraryName = 'uiTour';
//GENERAL CONFIG
let config = {
context: `${__dirname}`,
entry: __dirname + '/app/angular-ui-tour.js',
output: {
path: `${__dirname}/dist`,
filename: 'angular-ui-tour.js',
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true
},
resolve: {
modulesDirectories: ['node_modules', 'bower_components']
},
externals: [bowerExternals()],
module: {
loaders: [
{
//Load all JavaScript modules except external dependencies
test: /\.js$/,
exclude: /node_modules|bower_components/,
loaders: [
'string-replace?' + JSON.stringify({
search: 'Promise\\.resolve\\(\\)',
replace: '$q.resolve()',
flags: 'g'
}),
'ng-annotate?' + JSON.stringify({
add: true,
map: false
}),
'babel?' + JSON.stringify({})
]
},
{
//Load all templates into $templateCache
test: /(\.html)$/,
loaders: [`ng-cache?module=${moduleName}`]
},
{
test: /(\.css)$/,
loaders: ['style', 'css']
}
],
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules|bower_components|dist/,
loaders: ['eslint']
}
]
},
plugins: [
//allow external dependencies from Bower
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])
),
//clean dist directory
new CleanPlugin([
`${__dirname}/dist`,
`${__dirname}/.tmp`
])
],
eslint: {
failOnError: true,
emitError: true
}
};
module.exports = config;