forked from Hacker0x01/react-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drastically decrease size of the bundles (Hacker0x01#1695)
* 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
1 parent
0bd6993
commit f22cb5c
Showing
5 changed files
with
338 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.