-
Notifications
You must be signed in to change notification settings - Fork 60
/
webpack.config.dev.js
68 lines (65 loc) · 2.24 KB
/
webpack.config.dev.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
/* eslint-disable strict */
'use strict';
const APP_NAME = process.env.APP_NAME;
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const pkg = require('./package.json');
module.exports = {
devtool: 'cheap-module-source-map',
entry: [
'babel-polyfill',
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000',
path.join(__dirname, 'src', 'init', 'main.js'),
],
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]-[hash].js',
chunkFilename: '[id]-[hash].chunk.js',
publicPath: process.env.BASE_URL, // needs to be root
},
resolve: {
root: __dirname,
extensions: [ '', '.js' ],
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/init/index.html',
NODE_ENV: process.env.NODE_ENV,
APP_NAME,
}),
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify(pkg.version),
'process.env': {
APP_NAME: JSON.stringify(APP_NAME),
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
AUTH0_DOMAIN: JSON.stringify(process.env.AUTH0_DOMAIN),
AUTH0_PUB_KEY: JSON.stringify(process.env.AUTH0_PUB_KEY),
BASE_URL: JSON.stringify(process.env.BASE_URL),
},
}),
new ExtractTextPlugin('[name]-[hash].css', {
allChunks: true,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
],
module: {
loaders: [
{
test: /\.js$/,
exclude: [ /node_modules/, /__tests__/ ],
loader: 'babel-loader',
},
{ test: /\.json$/, loader: 'json' },
{ test: /\.(png|gif|jpg)$/, loader: 'url?limit=8192' },
{ test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&minetype=application/font-woff2' },
{ test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&minetype=application/font-woff' },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('css?sourceMap') },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('css?sourceMap!sass?sourceMap!postcss-loader') },
],
},
};