-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
88 lines (85 loc) · 2.65 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
79
80
81
82
83
84
85
86
87
88
require('babel-polyfill');
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
//const ExtractTextPlugin = require('extract-text-webpack-plugin');
const host = (process.env.HOST || 'localhost');
const port = (process.env.PORT) || 8081;
var assetsPath = path.join(__dirname, 'dist');
var nodeModulesPath = path.join(__dirname, 'node_modules');
module.exports = {
devtool: 'eval',
entry: [
'babel-polyfill',
'webpack-hot-middleware/client',
'./src/index.js'
],
output: {
filename: 'app.js',
path: assetsPath,
publicPath: '/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
}),
new HtmlWebpackPlugin({
title: 'RAYS-2.0',
filename: 'index.html',
template: 'index.template.html',
favicon: path.join(__dirname, 'favicon.ico')
}),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{ test: /\.json$/,
loader: "json-loader"
},
{ test: /\.js$/,
loader: "react-hot!babel",
exclude: [/node_modules/, /dist/]
},
{
test: /\.css$/,
loader: "style!css!postcss"
},
{
test: /\.scss$/,
loader: "style!css!postcss!sass"
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader?limit=8192&name=assets/images/[name].[ext]'
},
{ test: /\.(ttf|eot|svg|woff|woff2)(\?.*)?$/,
loader: "url-loader?limit=8192&name=assets/fonts/[name].[ext]"
}
],
noParse: [path.resolve(nodeModulesPath, '/react/dist/react.min'),path.resolve(nodeModulesPath, '/lodash/lodash.js')]
},
postcss: [
autoprefixer()
],
resolve: {
extensions: ['', '.json', '.js', '.map' ],
modulesDirectories: ["src", "node_modules"],
alias: {
'react-dom': path.join(nodeModulesPath, '/react-dom/dist/react-dom.js'),
'react-redux': path.join(nodeModulesPath, '/react-redux/dist/react-redux.js'),
'redux': path.join(nodeModulesPath, '/redux/dist/redux.js'),
'config': path.join(__dirname, 'config.js'),
'APIFolder': path.join(__dirname, './src/api'),
'UtilsFolder': path.join(__dirname, './src/utils'),
'UIComponentFolder': path.join(__dirname, './src/UIComponent'),
'PageComponentFolder': path.join(__dirname, './src/components/PageComponent'),
'ActionsFolder': path.join(__dirname, './src/actions'),
'AssetsFolder': path.join(__dirname, './src/assets')
}
}
};