Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize #268

Closed
wants to merge 2 commits into from

Conversation

Projects
None yet
4 participants
@noscripter
Copy link
Contributor

noscripter commented Apr 11, 2019

  • [x] extract process.env.NODE_ENV
  • more intuitive createChainableTypeChecker condition
  • use loose-envify as a devDependency
@TrySound

This comment has been minimized.

Copy link

TrySound commented Apr 11, 2019

@noscripter NODE_ENV is replaced statically with bundler for browsers. It should not be extracted.

@noscripter

This comment has been minimized.

Copy link
Contributor Author

noscripter commented Apr 11, 2019

@noscripter NODE_ENV is replaced statically with bundler for browsers. It should not be extracted.

Thanks for that info, can you provide more detail for me to dive into?

@TrySound

This comment has been minimized.

Copy link

TrySound commented Apr 11, 2019

This convention is shared across many packages (especially react ones)
https://github.com/rollup/rollup-plugin-replace
https://webpack.js.org/guides/production/#specify-the-mode

@noscripter

This comment has been minimized.

Copy link
Contributor Author

noscripter commented Apr 11, 2019

This convention is shared across many packages (especially react ones)
https://github.com/rollup/rollup-plugin-replace
https://webpack.js.org/guides/production/#specify-the-mode

Coool, thanks.

@noscripter noscripter force-pushed the noscripter:optimize branch from b609798 to 0817bf0 Apr 11, 2019

@@ -206,7 +206,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
}
}
}
if (props[propName] == null) {
// undefined == null and null == null are true
if (props[propName] === null || props[propName] === undefined) {

This comment has been minimized.

Copy link
@ljharb

ljharb Apr 11, 2019

Collaborator

why is this a better change? == null is more reliable, since undefined can be redefined.

This comment has been minimized.

Copy link
@noscripter

noscripter Apr 12, 2019

Author Contributor

why is this a better change? == null is more reliable, since undefined can be redefined.

Thanks @ljharb I found this question on stackoverflow, it looks like a problem related to legacy browsers only, but your review did make sense.

This comment has been minimized.

Copy link
@noscripter

noscripter Apr 12, 2019

Author Contributor

Also according to MDN, undefined should be un-writable but it's not a reserved word, so in some context it may be redefined as well.

(function() { var undefined = 'foo'; console.log(undefined, typeof undefined); })();
@@ -47,6 +46,7 @@
"eslint": "^5.13.0",
"in-publish": "^2.0.0",
"jest": "^19.0.2",
"loose-envify": "^1.4.0",

This comment has been minimized.

Copy link
@ljharb

ljharb Apr 11, 2019

Collaborator

this must be a runtime dependency, otherwise #203 (comment) breaks people.

This comment has been minimized.

Copy link
@noscripter

noscripter Apr 12, 2019

Author Contributor

this must be a runtime dependency, otherwise #203 (comment) breaks people.

Got it, I thought it was only used for build in the first place.

@noscripter noscripter closed this Apr 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.