Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

react: Use the react-hot-loader Babel plugin in production too #1213

Merged
merged 1 commit into from
Nov 20, 2018
Merged

react: Use the react-hot-loader Babel plugin in production too #1213

merged 1 commit into from
Nov 20, 2018

Conversation

edmorley
Copy link
Member

react-hot-loader internally uses process.env.NODE_ENV conditionals to make most of its functionality a no-op when in production.

Previously the production Babel plugin was a no-op too, however after gaearon/react-hot-loader#1081 and gaearon/react-hot-loader#1093 it now replaces instances of hot(module)(App) with App.

In addition to removing a few lines of RHL code, this allows webpack to now perform its module concatenation optimization, and avoids Content-Security-Policy script-src unsafe-eval false positives.

This change is compatible with all versions of RHL 4, however to see the benefit, users will need to upgrade to >=4.4.0 (in beta).

`react-hot-loader` internally uses `process.env.NODE_ENV` conditionals
to make most of its functionality a no-op when in production.

Previously the production Babel plugin was a no-op too, however after
gaearon/react-hot-loader#1081 and gaearon/react-hot-loader#1093 it
now replaces instances of `hot(module)(App)` with `App`.

In addition to removing a few lines of RHL code, this allows webpack
to now perform its module concatenation optimization, and avoids
Content-Security-Policy script-src `unsafe-eval` false positives.

This change is compatible with all versions of RHL 4, however to
see the benefit, users will need to upgrade to >=4.4.0 (in beta).
@edmorley edmorley added the bug label Nov 19, 2018
@edmorley edmorley added this to the v9 milestone Nov 19, 2018
@edmorley edmorley self-assigned this Nov 19, 2018
@edmorley edmorley merged commit 674fbd6 into neutrinojs:master Nov 20, 2018
@edmorley edmorley deleted the rhl-babel-prod branch November 20, 2018 16:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

2 participants