forked from geoinquietos-ar/foss4g-ar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
74 lines (71 loc) · 1.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
/* eslint import/no-extraneous-dependencies: ["error", {"peerDependencies": true}] */
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import path from 'path';
const plugins = [
new ExtractTextPlugin('main.css'),
new HtmlWebpackPlugin({
template: './src/templates/index.hbs',
favicon: './src/images/favicon.png',
}),
];
if (process.env.NODE_ENV === 'production') {
plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false },
output: { comments: false },
}));
plugins.push(new CopyWebpackPlugin([
{ from: './src/CNAME' },
]));
}
module.exports = {
entry: path.join(__dirname, 'src/scripts/main.js'),
output: {
path: path.join(__dirname, 'dist'),
filename: 'main.js',
},
devtool: 'source-map',
resolve: {
extensions: ['.js', '.css', '.scss'],
alias: {
leafletCSS: path.join(__dirname, '/node_modules/leaflet/dist/leaflet.css'),
},
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel-loader', 'eslint-loader'],
},
{
test: /\.hbs$/,
loader: 'handlebars-loader',
},
{
test: /\.scss$/,
exclude: /node_modules/,
loader: ExtractTextPlugin.extract({
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.(jpg|jpeg|gif|png|ico|svg)$/,
exclude: /node_modules/,
loader: 'file-loader',
},
],
},
plugins,
devServer: {
contentBase: 'dist/',
port: 9000,
hot: true,
host: '0.0.0.0',
stats: {
colors: true,
},
},
};