Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"plugins": [
"transform-object-rest-spread",
"transform-runtime"
"transform-object-rest-spread"
],
"presets": [
"es2015"
]
],
"env": {
"production": {
"plugins": [
"transform-runtime"
]
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"karma-phantomjs-launcher": "^1.0.4",
"karma-webpack": "^1.8.0",
"load-grunt-tasks": "^3.5.2",
"lodash": "^4.17.4",
"moment": "^2.14.1",
"node-sass": "^3.8.0",
"null-loader": "^0.1.1",
Expand Down
18 changes: 18 additions & 0 deletions webpack/webpack.config.production.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const merge = require('lodash/merge');
const path = require('path');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
Expand All @@ -20,6 +21,23 @@ webpackConfig.module.loaders = [{
test: /\.scss$/,
}];

// Add `forceEnv: 'prod'` to all babel postLoaders
webpackConfig.module.postLoaders = webpackConfig.module.postLoaders.map((loader) => {
if (loader.loader.indexOf('babel') !== 0) {
return loader;
}

return merge(
{},
loader,
{
query: {
forceEnv: 'production',
},
}
);
});

webpackConfig.plugins = [
new CleanWebpackPlugin('dist', {
root: path.resolve(__dirname, '..'),
Expand Down