forked from US-CBP/cbp-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
110 lines (103 loc) · 3.11 KB
/
webpack.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
99
100
101
102
103
104
105
106
107
108
109
110
"use strict";
let webpack = require('webpack'),
path = require('path'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
postcssImport = require('postcss-import'),
CopyWebpackPlugin = require('copy-webpack-plugin');
const defaultConfig = {
cache: true,
entry: {
'cbp-theme': './index.js',
'inputmask': './inputmask.js',
'cbp-theme.min': './index.js',
'inputmask.min': './inputmask.js',
},
eslint: {
configFile: '.eslintrc'
},
stats: {
colors: true,
reasons: true
},
devServer: {
contentBase : path.resolve('./app/kitchensink')
},
module: {
loaders: require('./webpack.loaders')
},
postcss: function (webpack) {
return [
postcssImport({
addDependencyTo: webpack
})
];
},
resolve: {
root: [
path.resolve('./app/'),
path.resolve('./node_modules/')
],
alias : {
"inputmask.dependencyLib": path.resolve('./node_modules/jquery.inputmask/dist/inputmask/inputmask.dependencyLib.jquery.js'),
"inputmask": path.resolve('./node_modules/jquery.inputmask/dist/inputmask/inputmask.js'),
"jquery.inputmask": path.resolve('./node_modules/jquery.inputmask/dist/inputmask/jquery.inputmask.js'),
"inputmaskDir": path.resolve('./node_modules/jquery.inputmask/dist/inputmask'),
"mdl-selectfield-module": path.resolve('./node_modules/mdl-selectfield/dist/mdl-selectfield.js')
},
extensions: [ '', '.json', '.js', '.min.js', '.bundle.js', '.css', '.min.css', '.scss', '.html' ]
},
sassLoader: {
includePaths: [path.resolve(__dirname, './node_modules')]
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new ExtractTextPlugin('cbp-theme.css', {
publicPath: "./",
allChunks : false
}),
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
comments: false
}),
new CopyWebpackPlugin([
{ from: 'app/styles', to: 'scss' }
])
]
};
const kitchensinkConfig = Object.assign({}, defaultConfig, {
devtool: "#eval",
debug: true,
output: {
libraryTarget: 'umd',
path: path.resolve('./app/kitchensink/dist'),
filename: '[name].js',
chunkFilename: "[hash]/js/[id].js"
},
externals: {
'jquery': {
root: 'jQuery',
commonjs2: 'jquery',
commonjs: 'jquery',
amd: 'jquery'
}
}
});
const standardDistConfig = Object.assign({}, defaultConfig, {
output: {
libraryTarget: 'umd',
path: path.resolve('./dist'),
filename: '[name].js',
chunkFilename: "[hash]/js/[id].js"
},
externals: {
'jquery': {
root: 'jQuery',
commonjs2: 'jquery',
commonjs: 'jquery',
amd: 'jquery'
}
}
});
module.exports = [ standardDistConfig, kitchensinkConfig ];