forked from shakacode/react-webpack-rails-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.client.hot.config.js
70 lines (60 loc) · 1.93 KB
/
webpack.client.hot.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
// Run like this:
// cd client && node server.js
const webpack = require('webpack');
const path = require('path');
const config = require('./webpack.client.base.config');
// We're using the bootstrap-sass loader.
// See: https://github.com/shakacode/bootstrap-sass-loader
config.entry.vendor.push('bootstrap-sass!./bootstrap-sass.config.js');
config.entry.app.push(
// Webpack dev server
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/dev-server',
// Test out Css & Sass
'./assets/stylesheets/test-stylesheet.css',
'./assets/stylesheets/test-sass-stylesheet.scss',
// App entry point
'./app/startup/clientGlobals'
);
config.output = {
// this file is served directly by webpack
filename: '[name]-bundle.js',
path: __dirname,
};
config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
config.devtool = 'eval-source-map';
// All the styling loaders only apply to hot-reload, not rails
config.module.loaders.push(
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
query: {
plugins: ['react-transform'],
extra: {
'react-transform': {
transforms: [
{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module'],
},
],
},
},
},
},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{
test: /\.scss$/,
loader: 'style!css!sass?outputStyle=expanded&imagePath=/assets/images&includePaths[]=' +
path.resolve(__dirname, './assets/stylesheets'),
},
// The url-loader uses DataUrls. The file-loader emits files.
{test: /\.woff$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'},
{test: /\.woff2$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'},
{test: /\.ttf$/, loader: 'file-loader'},
{test: /\.eot$/, loader: 'file-loader'},
{test: /\.svg$/, loader: 'file-loader'}
);
module.exports = config;