We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
module.hot not replace to false in production build
module.hot
false
index.html
<script src="script.js"></script>
script.js
if (module.hot) { module.hot.dispose(function () { console.log('OLOLOOOOO') }) }
in production build all code like module.hot will be replace to false, like:
if (false) { module.hot.dispose(function () { console.log('OLOLOOOOO') }) }
and minificator will remove all if(false){ } code blocks from production build
if(false){ }
hot reload code get to the production bundle:
}({ "mpVp": [function (require, module, exports) { module.hot && module.hot.dispose(function () { console.log("OLOLOOOOO") }); }, {}] }, {}, ["mpVp"], null)
this is not a good idea
you must replace module.hot in all scripts to false keyword, that's exactly what webpack does.
I use Parcel v1.12.4
The text was updated successfully, but these errors were encountered:
what is the parcel version? Or the command you ran?
Sorry, something went wrong.
@DeMoorJasper parcel v1.12.4
parcel v1.12.4
command:
parcel build index.html
No branches or pull requests
馃悰 bug report
module.hot
not replace tofalse
in production build馃 Expected Behavior
index.html
script.js
in production build all code like
module.hot
will be replace tofalse
, like:and minificator will remove all
if(false){ }
code blocks from production build馃槸 Current Behavior in Parcel v1.12.4
hot reload code get to the production bundle:
this is not a good idea
馃拋 Possible Solution
you must replace
module.hot
in all scripts tofalse
keyword, that's exactly what webpack does.I use Parcel v1.12.4
The text was updated successfully, but these errors were encountered: