mirror of
https://github.com/react-webpack-generators/generator-react-webpack.git
synced 2025-12-08 18:01:59 +00:00
Signed-off-by: Simon Bailey <simon@newtriks.com> Conflicts: templates/common/_webpack.config.js templates/common/_webpack.dist.config.js
70 lines
1.7 KiB
JavaScript
70 lines
1.7 KiB
JavaScript
/*
|
|
* Webpack development server configuration
|
|
*
|
|
* This file is set up for serving the webpack-dev-server, which will watch for changes and recompile as required if
|
|
* the subfolder /webpack-dev-server/ is visited. Visiting the root will not automatically reload.
|
|
*/
|
|
'use strict';
|
|
var webpack = require('webpack');
|
|
|
|
module.exports = {
|
|
|
|
output: {
|
|
filename: 'main.js',
|
|
publicPath: '/assets/'
|
|
},
|
|
|
|
cache: true,
|
|
debug: true,
|
|
devtool: false,
|
|
entry: [
|
|
'webpack/hot/only-dev-server',
|
|
'./src/scripts/components/<% if (reactRouter) { %>main<% } else { %><%= scriptAppName %><% } %>.js'
|
|
],
|
|
|
|
stats: {
|
|
colors: true,
|
|
reasons: true
|
|
},
|
|
|
|
resolve: {
|
|
extensions: ['', '.js']
|
|
},
|
|
module: {
|
|
preLoaders: [{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
loader: 'jshint'
|
|
}],
|
|
loaders: [{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
loader: 'react-hot!<% if (es6) { %>babel!<% }%>jsx-loader?harmony'
|
|
},<% if (stylesLanguage === 'sass') { %> {
|
|
test: /\.sass/,
|
|
loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded'
|
|
},<% } %><% if (stylesLanguage === 'scss') { %> {
|
|
test: /\.scss/,
|
|
loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded'
|
|
},<% } %><% if (stylesLanguage === 'less') { %> {
|
|
test: /\.less/,
|
|
loader: 'style-loader!css-loader!less-loader'
|
|
},<% } %><% if (stylesLanguage === 'stylus') { %> {
|
|
test: /\.styl/,
|
|
loader: 'style-loader!css-loader!stylus-loader'
|
|
},<% } %> {
|
|
test: /\.css$/,
|
|
loader: 'style-loader!css-loader'
|
|
}, {
|
|
test: /\.(png|jpg)$/,
|
|
loader: 'url-loader?limit=8192'
|
|
}]
|
|
},
|
|
|
|
plugins: [
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
new webpack.NoErrorsPlugin()
|
|
]
|
|
|
|
};
|