-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
95 lines (92 loc) · 2.18 KB
/
Copy pathwebpack.config.dev.js
File metadata and controls
95 lines (92 loc) · 2.18 KB
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
86
87
88
89
90
91
92
93
94
95
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const basePath = path.join(__dirname, 'app');
const distPath = path.join(__dirname, 'dist');
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: {
vendor: './app/vendor.js',
app: './app/index.jsx'
},
output: {
path: distPath,
publicPath: '/',
filename: '[name].[chunkhash].js'
},
plugins: [
new CleanWebpackPlugin(['dist']),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor'
}),
new HtmlWebpackPlugin({
title: 'Default Template',
template: './app/index.ejs',
filename: 'index.html'
}),
new ExtractTextPlugin({
filename: 'style.css'
})
],
resolve: {
extensions: ['.js', '.jsx'],
modules: [
path.resolve(`${basePath}`),
path.resolve('node_modules/')
]
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: ['babel-loader'],
include: basePath
},
{
test: /\.global\.scss$/,
exclude: /node_modules/,
include: basePath,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader']
})
},
{
test: /\.scss$/,
exclude: [/node_modules/, /\.global\.scss$/],
include: basePath,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader?modules', 'postcss-loader', 'sass-loader']
})
},
{
test: /\.(png|svg|jpg|gif)$/,
include: basePath,
use: [
'file-loader'
]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
include: basePath,
use: [
'file-loader'
]
}
]
},
devServer: {
contentBase: distPath,
port: 7777,
host: 'localhost',
historyApiFallback: true,
noInfo: false,
proxy: {
'/api': 'http://localhost:8000'
}
}
};