This repository was archived by the owner on Feb 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.config.js
78 lines (75 loc) · 1.72 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
/* eslint-disable */
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import path from 'path';
import settings from './settings';
const { server: { port, host, proxyPort, proxyHost } } = settings;
const SRC = path.resolve('./app/src');
const DIST = path.resolve('./app/dist');
const PUBLIC_PATH = '/assets/';
export default env => ({
entry: [
'./app/src/index.js',
],
output: {
path: DIST,
filename: 'bundle.js',
publicPath: PUBLIC_PATH,
},
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
},
],
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
},
{
test: /\.(png|jpg|svg|gif|mp4)$/,
loaders: [
'url?limit=20000',
],
},
{
test: /\.scss$/,
exclude: /node_modules/,
loaders: env && !env.prod
? 'style?sourceMap!css!sass'
: ExtractTextPlugin.extract({ fallbackLoader: 'style', loader: 'css?sourceMap!sass' }),
},
],
},
devtool: env && env.prod ? 'source-map' : 'cheap-module-eval-source-map',
resolve: {
extensions: ['', '.js'],
modules: [
SRC,
'node_modules'
],
},
plugins: [
new ExtractTextPlugin('styles.css'),
new webpack.ProvidePlugin({
fetch: 'imports?this=>global!exports?global.fetch!isomorphic-fetch',
}),
new webpack.NoErrorsPlugin(),
],
devServer: {
compress: true,
historyApiFallback: true,
host: proxyHost,
port: proxyPort,
proxy: {
'**': `http://${host}:${port}`,
}
},
});