You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I copy/pasted hmr-runtime and added bundle.env.context === 'node' to the short-circuit condition.
So far, this seems to fix it, but not sure if they are unintended side-effects, or why it might not have been included originally.
if(bundle.type!=='js'||!options.hmrOptions||bundle.env.isLibrary||bundle.env.isWorklet()||bundle.env.sourceType==='script'||bundle.env.context==='node'// (?) add this (?)){return}
🔦 Context
I'm trying to build a webapp and serverless functions in the same project so there are node and web targets. (Prebuilding the node targets makes them more easily portable across serverless providers.)
Not important, because the hmr-runtime tweak seems to work, but - Am I not supposed to be building web and node targets with the same parcel instance?
The reason I ask is that running with the --no-hmr flag has a problem with my particular situation because it turns off hmr for both the node and web targets, so unlike the hmr-runtime tweak, it appears to lose hmr completely, not just for the node targets.
// my parcel wrapperconstparcel=newParcel({
...
entries: ['packages/webapp','packages/api'],mode: 'development',hmrOptions: {port: 2346},serveOptions: false// everything except hmr is served by firebase-tools})
🐛 bug report
In a project with both web and node targets, Parcel adds the hmr-runtime to both
web
andnode
targets.🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
Parcel doesn't add hmr-runtime to node targets
😯 Current Behavior
Parcel adds the hmr-runtime to node targets
💁 Possible Solution
bundle.env.context === 'node'
to the short-circuit condition.🔦 Context
I'm trying to build a webapp and serverless functions in the same project so there are node and web targets. (Prebuilding the node targets makes them more easily portable across serverless providers.)
💻 Code Sample
https://github.com/tony-g/parcel-hmr-node/
🌍 Your Environment
The text was updated successfully, but these errors were encountered: