-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.dev.config.js
98 lines (82 loc) · 2.27 KB
/
webpack.dev.config.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
var path = require('path'),
webpack = require('webpack'),
libPath = path.join(__dirname, 'lib'),
nodeModulesPath = path.join(__dirname, 'node_modules'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
ProgressBarPlugin = require('progress-bar-webpack-plugin'), // To be delete when webpack will accept the flag --progress in the devserver and not only in CMD
WatchIgnorePlugin = require('watch-ignore-webpack-plugin'),
SassLintPlugin = require('sasslint-webpack-plugin');
var cf = {
entry: path.join(libPath, 'index.js'),
devtool: 'source-map',
resolve: {
root: [path.resolve(__dirname, 'lib'), path.resolve(__dirname, 'node_modules')],
extensions: ['', '.js', '.json', '.scss']
},
debug: true,
cache: false,
module: {
loaders: [{
test: /\.json$/,
exclude: /node_modules/,
loaders: ["raw-loader"]
},{
test: /\.html$/,
exclude: /node_modules/,
loader: 'ngtemplate!html'
},{
test: /\.(jpe?g|gif|png|svg|woff|woff2|ttf|eot|wav|mp3)$/,
loader: 'file' // inline base64 URLs for <=10kb images, direct URLs for the rest
},{
test: /\.less$/,
exclude: /node_modules/,
loaders: ['style', 'css', 'less?sourceMap', 'resolve-url']
},{
test: /\.scss$|\.css$/,
exclude: /node_modules/,
loaders: ['style', 'css-loader', 'resolve-url', 'sass?sourceMap']
},{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['ng-annotate?add=true&map=true', 'babel', 'eslint-loader']
}]
},
eslint: {
configFile: './.eslintrc'
},
devServer: {
port: 3001,
https: false,
inline: true,
compress: true,
hot: true,
open: true,
noInfo: true
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: path.join(libPath, 'index.ejs'),
title: 'My App',
cache: false,
hash: true,
chunksSortMode: 'auto'
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.HotModuleReplacementPlugin(),
new WatchIgnorePlugin([
path.resolve( __dirname, './examples/'),
path.resolve(__dirname, './node_modules/'),
]),
new SassLintPlugin({
glob: 'lib/**/*.s?(a|c)ss',
ignorePlugins: [
'extract-text-webpack-plugin'
],
configFile: '.sass-lint.yml'
}),
new ProgressBarPlugin({format: ' build [:bar] ' + (':percent') + ' (:elapsed seconds)'})
]
};
module.exports = cf;