forked from djtsai/react-starter-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
62 lines (58 loc) · 1.67 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
"use strict"
const webpack = require("webpack")
const path = require("path")
const ExtractTextPlugin = require("extract-text-webpack-plugin")
const SOURCE_DIR = path.resolve(__dirname, 'src')
const PUBLIC_DIR = path.resolve(__dirname, 'public')
const BUILD_DIR = path.resolve(__dirname, 'public/dist')
const environment = process.env.NODE_ENV || "production"
module.exports = {
entry: SOURCE_DIR + "/main.jsx",
output: {
publicPath: "/dist/",
path: BUILD_DIR,
filename: "bundle.js"
},
resolve: {
alias: {
actions: SOURCE_DIR + "/actions",
components: SOURCE_DIR + "/components",
constants: SOURCE_DIR + "/constants",
containers: SOURCE_DIR + "/containers",
reducers: SOURCE_DIR + "/reducers",
server: SOURCE_DIR + "/server"
},
extensions: [".js", ".jsx", ".json"]
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
"NODE_ENV": JSON.stringify(environment)
}
}),
new ExtractTextPlugin("bundle.css")
],
module: {
loaders : [
{
test: /\.jsx?/,
include: SOURCE_DIR,
loader: "babel-loader"
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(["css-loader"])
},
{
test: /\.scss$/,
loaders: ExtractTextPlugin.extract(["css-loader", "sass-loader"])
}
]
},
devServer: {
port:3000,
historyApiFallback: true,
inline: true,
contentBase: PUBLIC_DIR
}
}