Better webpack settings for development
This commit is contained in:
@ -22,7 +22,7 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
|
|
||||||
app.use(convert(devMiddleware(compile, {
|
app.use(convert(devMiddleware(compile, {
|
||||||
// display no info to console (only warnings and errors)
|
// display no info to console (only warnings and errors)
|
||||||
noInfo: false,
|
noInfo: true,
|
||||||
|
|
||||||
// display nothing to the console
|
// display nothing to the console
|
||||||
quiet: false,
|
quiet: false,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
||||||
|
|
||||||
const commonWebpackConfig = require('./webpack.config');
|
const commonWebpackConfig = require('./webpack.config');
|
||||||
|
|
||||||
@ -15,10 +14,13 @@ const developmentWebpackConfig = Object.assign(commonWebpackConfig, {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
developmentWebpackConfig.module.loaders.push({
|
||||||
|
test: /\.s?css$/,
|
||||||
|
loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap',
|
||||||
|
});
|
||||||
developmentWebpackConfig.plugins.push(new webpack.optimize.OccurenceOrderPlugin());
|
developmentWebpackConfig.plugins.push(new webpack.optimize.OccurenceOrderPlugin());
|
||||||
developmentWebpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
developmentWebpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
||||||
developmentWebpackConfig.plugins.push(new webpack.NoErrorsPlugin());
|
developmentWebpackConfig.plugins.push(new webpack.NoErrorsPlugin());
|
||||||
developmentWebpackConfig.plugins.push(new ExtractTextPlugin('styles.css'));
|
|
||||||
developmentWebpackConfig.plugins.push(new HtmlWebpackPlugin({
|
developmentWebpackConfig.plugins.push(new HtmlWebpackPlugin({
|
||||||
title: 'Atlas',
|
title: 'Atlas',
|
||||||
}));
|
}));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
||||||
|
|
||||||
// Load .env
|
// Load .env
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
@ -27,10 +26,6 @@ module.exports = {
|
|||||||
include: path.join(__dirname, 'frontend')
|
include: path.join(__dirname, 'frontend')
|
||||||
},
|
},
|
||||||
{ test: /\.json$/, loader: 'json-loader' },
|
{ test: /\.json$/, loader: 'json-loader' },
|
||||||
{
|
|
||||||
test: /\.s?css$/,
|
|
||||||
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap')
|
|
||||||
},
|
|
||||||
{ test: /\.(png|jpg|svg)$/, loader: 'url-loader' }, // inline base64 URLs for <=8k images, direct URLs for the rest
|
{ test: /\.(png|jpg|svg)$/, loader: 'url-loader' }, // inline base64 URLs for <=8k images, direct URLs for the rest
|
||||||
{
|
{
|
||||||
test: /\.woff$/,
|
test: /\.woff$/,
|
||||||
@ -57,4 +52,7 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en)$/)
|
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en)$/)
|
||||||
],
|
],
|
||||||
|
stats: {
|
||||||
|
assets: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,10 @@ productionWebpackConfig = Object.assign(commonWebpackConfig, {
|
|||||||
publicPath: '/static/',
|
publicPath: '/static/',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
productionWebpackConfig.module.loaders.push({
|
||||||
|
test: /\.s?css$/,
|
||||||
|
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap')
|
||||||
|
});
|
||||||
productionWebpackConfig.plugins.push(new HtmlWebpackPlugin({
|
productionWebpackConfig.plugins.push(new HtmlWebpackPlugin({
|
||||||
template: 'server/static/index.html'
|
template: 'server/static/index.html'
|
||||||
}));
|
}));
|
||||||
|
Reference in New Issue
Block a user