forked from benmarch/angular-ui-tour
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
98 lines (95 loc) · 2.73 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
'use strict';
//IMPORTS
const path = require('path'),
webpack = require('webpack'),
CleanPlugin = require('clean-webpack-plugin'),
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'
},
externals: {
"angular": "angular",
"angular-hotkeys": "angular-hotkeys",
"angular-sanitize": "angular-sanitize",
"angular-scroll": "angular-scroll",
"angular-bind-html-compile": "angular-bind-html-compile",
"hone": {
commonjs: "hone",
commonjs2: "hone",
amd: "Hone",
root: "Hone"
},
"tether": {
commonjs: "tether",
commonjs2: "tether",
amd: "Tether",
root: "Tether"
}
},
module: {
rules: [
{
//Load all JavaScript modules except external dependencies
test: /\.js$/,
exclude: /node_modules|bower_components/,
use: [
{
loader: 'string-replace-loader',
options: {
search: 'Promise\\.resolve\\(\\)',
replace: '$q.resolve()',
flags: 'g'
}
},
{
loader: 'ng-annotate-loader',
options: {
add: true,
map: false
}
},
{
loader: 'babel-loader'
}
]
},
{
//Load all templates into $templateCache
test: /(\.html)$/,
use: [`ng-cache-loader?module=${moduleName}`]
},
{
test: /(\.css)$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.js$/,
enforce: 'pre',
exclude: /node_modules|bower_components|dist/,
use: [{
loader: 'eslint-loader',
options: {
failOnError: true,
emitError: true
}
}]
}
]
},
plugins: [
//clean dist directory
new CleanPlugin([
`${__dirname}/dist`,
`${__dirname}/.tmp`
])
]
};
module.exports = config;