-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
53 lines (50 loc) · 1.48 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
var path = require('path');
var webpack = require('webpack');
const validate = require('webpack-validator');
// var ExtractTextPlugin = require('extract-text-webpack-plugin');
var BUILD_NAME = 'build/'; // publicPath: '/' // publicPath: '/assets/'
var SRC_NAME = 'src/';
var BUILD_DIR = path.resolve(__dirname, BUILD_NAME); //path.join(__dirname, '/dist'), // path.resolve(__dirname, 'dist'),
var SRC_DIR = path.resolve(__dirname, SRC_NAME); //path.join(__dirname, 'src'),
module.exports = validate({
devtool: 'source-map', // 'eval' for development, 'source-map' for production
debug: true,
entry: [
'webpack-dev-server/client?http://localhost:3000', // WebpackDevServer host and port
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
'./' + SRC_NAME + 'index', // Your appʼs entry point
'./src/styles/global.scss'
],
output: {
path: BUILD_DIR,
pathinfo: true,
filename: 'index.js',
publicPath: '/' + BUILD_NAME
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['react-hot-loader/webpack', 'babel'],
include: SRC_DIR,
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: ['style', 'css?sourceMap', 'sass?sourceMap']
},
{
test: /\.css$/,
loaders: ['style', 'css?sourceMap']
},
// {
// test: /\.scss$/,
// loader: ExtractTextPlugin.extract('css!sass')
// }
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
// new ExtractTextPlugin("build/styles.css", {allChunks: false}),
]
});