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 suspect an issue where importing and exporting from the same file, along with sideEffects: false causes Parcel to drop the import as unused. This may be related to #7622 but it seems distinct enough to merit a separate issue.
import{tokens}from"./tokens";console.log(tokens.color.blue);// ❌ fails as `tokens.color` is `undefined`
tokens.js
import{color}from"./color";// 💡 Uncommenting the line below fixes the issue// console.log(color);exportconsttokens={
color,};// 💡 Alternatively commenting out this line fixes the issueexport{mode}from"./color";
🐛 bug report
I suspect an issue where importing and exporting from the same file, along with
sideEffects: false
causes Parcel to drop the import as unused. This may be related to #7622 but it seems distinct enough to merit a separate issue.Minimal repro (repository with full code):
package.json
index.js
tokens.js
color.js
🎛 Configuration (.babelrc, package.json, cli command)
No notable config beyond
sideEffects: false
in the package.json.🤔 Expected Behavior
tokens.color.blue
should be defined withinindex.js
.😯 Current Behavior
Parcel is dropping the
color.js
module thinking it's unused unless I add aconsole.log
or uncomment the export at the bottom.💁 Possible Solution
Not sure yet. I'll need to dig into Parcel core to propose something.
🔦 Context
We ran into this bug with one of our internal libraries that is side effect free. It was causing a page to not load correctly.
💻 Code Sample
https://github.com/jondlm/parcel-bug-side-effect-export
🌍 Your Environment
The text was updated successfully, but these errors were encountered: