Fixed source maps

This commit is contained in:
Jori Lallo 2017-05-17 00:09:47 -07:00
parent ff17047791
commit f70e2326c0
2 changed files with 32 additions and 21 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable */
var webpack = require('webpack'); var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin');
@ -5,7 +6,7 @@ const commonWebpackConfig = require('./webpack.config');
const developmentWebpackConfig = Object.assign(commonWebpackConfig, { const developmentWebpackConfig = Object.assign(commonWebpackConfig, {
cache: true, cache: true,
devtool: 'eval', devtool: 'eval-source-map',
entry: [ entry: [
'babel-polyfill', 'babel-polyfill',
'babel-regenerator-runtime', 'babel-regenerator-runtime',
@ -18,11 +19,15 @@ developmentWebpackConfig.module.loaders.push({
test: /\.s?css$/, test: /\.s?css$/,
loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap', 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 HtmlWebpackPlugin({ developmentWebpackConfig.plugins.push(
title: 'Atlas', new HtmlWebpackPlugin({
})); title: 'Atlas',
})
);
module.exports = developmentWebpackConfig; module.exports = developmentWebpackConfig;

View File

@ -1,18 +1,15 @@
/* eslint-disable */
var path = require('path'); var path = require('path');
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"); var ExtractTextPlugin = require('extract-text-webpack-plugin');
commonWebpackConfig = require('./webpack.config'); commonWebpackConfig = require('./webpack.config');
productionWebpackConfig = Object.assign(commonWebpackConfig, { productionWebpackConfig = Object.assign(commonWebpackConfig, {
cache: true, cache: true,
devtool: 'cheap-module-source-map', devtool: 'cheap-module-source-map',
entry: [ entry: ['babel-polyfill', 'babel-regenerator-runtime', './frontend/index'],
'babel-polyfill',
'babel-regenerator-runtime',
'./frontend/index',
],
output: { output: {
path: path.join(__dirname, 'dist'), path: path.join(__dirname, 'dist'),
filename: 'bundle.[hash].js', filename: 'bundle.[hash].js',
@ -21,25 +18,34 @@ productionWebpackConfig = Object.assign(commonWebpackConfig, {
}); });
productionWebpackConfig.module.loaders.push({ productionWebpackConfig.module.loaders.push({
test: /\.s?css$/, test: /\.s?css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap') 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(
template: 'server/static/index.html' new HtmlWebpackPlugin({
})); template: 'server/static/index.html',
productionWebpackConfig.plugins.push(new ExtractTextPlugin('styles.[hash].css')); })
productionWebpackConfig.plugins.push(new webpack.optimize.OccurenceOrderPlugin()); );
productionWebpackConfig.plugins.push(
new ExtractTextPlugin('styles.[hash].css')
);
productionWebpackConfig.plugins.push(
new webpack.optimize.OccurenceOrderPlugin()
);
productionWebpackConfig.plugins.push( productionWebpackConfig.plugins.push(
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
compress: { compress: {
warnings: false warnings: false,
} },
}) })
); );
productionWebpackConfig.plugins.push( productionWebpackConfig.plugins.push(
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
'NODE_ENV': JSON.stringify('production') NODE_ENV: JSON.stringify('production'),
} },
}) })
); );