Skip to content

Commit

Permalink
Drastically decrease size of the bundles (Hacker0x01#1695)
Browse files Browse the repository at this point in the history
* Mark all date-fns subpackages as external dependencies.

* Remove lodash.

* Add `transform-react-remove-prop-types` to babel config for production builds.
  • Loading branch information
igoradamenko authored and martijnrusschen committed Apr 14, 2019
1 parent 0bd6993 commit f22cb5c
Show file tree
Hide file tree
Showing 5 changed files with 338 additions and 50 deletions.
38 changes: 21 additions & 17 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
var NODE_ENV = process.env.NODE_ENV;
var MODULES = process.env.MODULES;

var modules = MODULES === 'false' || NODE_ENV === 'test' ? 'commonjs' : false;
var modules = MODULES === "false" || NODE_ENV === "test" ? "commonjs" : false;

var config = {
presets: [
[
'env',
"env",
{
loose: true,
modules: modules,
forceAllTransforms: NODE_ENV === 'production',
},
forceAllTransforms: NODE_ENV === "production"
}
],
'stage-0',
'react',
"stage-0",
"react"
],
plugins: [],
plugins: []
};

if (NODE_ENV === 'development') {
if (NODE_ENV === "development") {
config.plugins = config.plugins.concat([
'transform-class-properties',
"transform-class-properties",
[
'react-transform',
"react-transform",
{
transforms: [
{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module'],
},
],
},
transform: "react-transform-hmr",
imports: ["react"],
locals: ["module"]
}
]
}
],
'add-react-displayname',
"add-react-displayname"
]);
}

if (NODE_ENV === "production") {
config.plugins = config.plugins.concat(["transform-react-remove-prop-types"]);
}

module.exports = config;
Loading

0 comments on commit f22cb5c

Please sign in to comment.