-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
82 lines (80 loc) · 2.01 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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var dir_js = path.resolve(__dirname, 'app');
var dir_assets = path.resolve(__dirname, 'app', 'assets');
var dir_build = path.resolve(__dirname, 'dist');
module.exports = {
entry: {
app : path.resolve(__dirname, 'index.js')
},
output: {
path: dir_build,
filename: 'bundle.js'
},
resolve: {
modulesDirectories: ['node_modules', dir_js],
},
devServer: {
contentBase: dir_build,
},
postcss: function () {
return [require('autoprefixer')];
},
devtool: 'source-map',
stats: {
colors: true,
chunkModules: false
},
plugins: [
new ExtractTextPlugin('[name].css', { allChunks: true }),
new webpack.optimize.CommonsChunkPlugin('vendor', '[name].js'),
new webpack.NoErrorsPlugin(),
new CopyWebpackPlugin([
{
from: './app/assets',
to: 'assets'
}
]),
new CopyWebpackPlugin([
{
from: './node_modules/font-awesome/fonts',
to: 'fonts'
}
]),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
})
],
module: {
loaders: [
{
loader: 'file?name=assets[name].[ext]',
test: /\.png($|\?)|\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/
},
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/,
presets : ['es2015']
},
{
loader: 'file?name=/[name].html',
test: /index.html$/
},
{
loader: 'raw',
test: /\.html$/,
exclude: /index.html$/
},
{
// loader: ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap!postcss-loader!less-loader?sourceMap'),
loader: ExtractTextPlugin.extract('style-loader', 'raw-loader?sourceMap!postcss-loader!less-loader?sourceMap'),
test: /\.less$/
}
]
}
}