-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
114 lines (111 loc) · 3.42 KB
/
Copy pathwebpack.config.js
File metadata and controls
114 lines (111 loc) · 3.42 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
const webpack = require('webpack');
const path = require('path');
// const rules = require('./config/rules');
// const plugins = require('./config/plugins');
// const envFile = require('node-env-file');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// const precss = require('precss');
const autoprefixer = require('autoprefixer');
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
process.env.PWD = process.cwd();
module.exports = {
devtool: process.env.NODE_ENV === 'production' ? '' : 'source-map',
context: path.resolve(__dirname, './app'),
entry: [
// 'webpack-dev-server/client?http://localhost:8080',
// 'webpack/hot/dev-server',
'./app.jsx'
],
node: {
fs: 'empty'
},
output: {
path: path.resolve(__dirname, './dist'),
filename: 'bundle.js'
},
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, './app')
],
alias: {
components: path.resolve(__dirname, 'app', 'components'),
actions: path.resolve(__dirname, 'app', 'actions', 'actions.js'),
app: path.resolve(__dirname, 'app'),
images: path.resolve(__dirname, 'app', 'images'),
utils: path.resolve(__dirname, 'app', 'utils'),
models: path.resolve(__dirname, 'app', 'models')
},
extensions: ['.js', '.jsx', '.css', '.scss']
},
module: {
rules: [
{
test: /\.js?$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
},
// {
// test: /\.js?$/,
// exclude: /(node_modules|bower_components)/,
// loader: 'eslint-loader'
// },
// {
// test: /\.jsx?$/,
// exclude: /(node_modules|bower_components)/,
// loader: 'eslint-loader'
// },
{
test: /\.scss/,
loaders: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
},
{
test: /\.css/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=8192'
},
{
test: /\.(mp4|mov)$/,
loader: 'url-loader?limit=10000&mimetype=video/mp4'
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: './index.html',
filename: 'index.html'
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.LoaderOptionsPlugin({
options: {
postcss: [autoprefixer]
}
})
],
devServer: process.env.NODE_ENV === 'production' ? {} : {
contentBase: './dist',
hot: true,
historyApiFallback: true
// proxy: [ {
// path: '/api/*',
// target: 'http://localhost:3000'
// }]
}
};