-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
85 lines (81 loc) · 2.15 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
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyEsPlugin = require('uglify-es-webpack-plugin');
const webpack = require('webpack');
const vuePath = (process.env.NODE_ENV === 'development') ? 'vue/dist/vue.js' : 'vue/dist/vue.min.js';
const app = {
entry : { main : './views/main.js'},
output : {
path : `${__dirname}/public/javascripts`,
filename : 'bundle.js',
chunkFilename : '[name].chunk.js',
publicPath : 'javascripts/'
},
module : {
rules : [
{
test : /\.vue$/,
use : [
'cache-loader',
'vue-loader'
]
},
{
test : /\.(jpg|png)$/,
use : [
'cache-loader',
'file-loader?name=../images/[name].[ext]'
]
}
]
},
plugins : [
new webpack.optimize.CommonsChunkPlugin({ name : 'main', filename : 'common.js' }),
new webpack.optimize.OccurrenceOrderPlugin(true),
new UglifyEsPlugin({ output : { comments : require('uglify-save-license') } }),
new webpack.ProvidePlugin({
$ : 'jquery',
jQuery : 'jquery',
'window.jQuery' : 'jquery',
Popper : ['popper.js', 'default'],
})
],
resolve : {
alias : {
bootstrap : 'bootstrap/dist/js/bootstrap.min.js',
jquery : 'jquery/dist/jquery.min.js',
vue : vuePath
}
},
cache : true
};
const bootstrap = {
entry : [
`${__dirname}/node_modules/bootstrap/dist/css/bootstrap.min.css`,
`${__dirname}/node_modules//font-awesome/css/font-awesome.min.css`,
],
output : {
path : `${__dirname}/public/stylesheets`,
filename : 'bundle.css'
},
module : {
loaders : [
{
test : /\.css$/,
loader : ExtractTextPlugin.extract('css-loader')
},
{
test : /\.(woff|woff2|eot|ttf|svg)$/,
loader : 'file-loader?name=../fonts/[name].[ext]'
},
{
test : /\.(jpg|png)$/,
loader : 'file-loader?name=../images/[name].[ext]'
}
]
},
plugins : [
new ExtractTextPlugin('../stylesheets/bundle.css')
],
cache : true
};
module.exports = [app, bootstrap];