Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"promise-polyfill": "^6.0.2",
"raw-loader": "^0.5.1",
"recursive-copy": "^2.0.6",
"replace-bundle-webpack-plugin": "^1.0.0",
"rimraf": "^2.6.1",
"script-ext-html-webpack-plugin": "^1.8.0",
"simplehttp2server": "^1.0.0",
Expand All @@ -130,6 +129,7 @@
"url-loader": "^0.5.8",
"webpack": "^2.3.3",
"webpack-dev-server": "^2.4.5",
"webpack-plugin-replace": "^1.1.0",
"yargs": "^8.0.1"
}
}
14 changes: 8 additions & 6 deletions src/lib/webpack-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
import ScriptExtHtmlWebpackPlugin from 'script-ext-html-webpack-plugin';
import ProgressBarPlugin from 'progress-bar-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import ReplacePlugin from 'replace-bundle-webpack-plugin';
import ReplacePlugin from 'webpack-plugin-replace';
import SWPrecacheWebpackPlugin from 'sw-precache-webpack-plugin';
import createBabelConfig from './babel-config';
import prerender from './prerender';
Expand Down Expand Up @@ -378,11 +378,13 @@ const production = config => addPlugins([
}),

// strip out babel-helper invariant checks
new ReplacePlugin([{
// this is actually the property name https://github.com/kimhou/replace-bundle-webpack-plugin/issues/1
partten: /throw\s+(new\s+)?(Type|Reference)?Error\s*\(/g,
replacement: () => 'return;('
}]),
new ReplacePlugin({
include: /babel-helper$/,
patterns: [{
regex: /throw\s+(new\s+)?(Type|Reference)?Error\s*\(/g,
value: 'return;('
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per slack, we should make sure to retain the offset here via space padding:

value: s => `return;${new Array(s.length-8).join(' ')}(`

}]
}),

new webpack.optimize.UglifyJsPlugin({
output: {
Expand Down