When two different modules contain the same code, they are collapsed such that the code does not get executed as required.
For example, react-bootstrap contains two files with this content:
import React from 'react';
export default React.createContext(null);
With parcel, these "two modules" actually execute only once and return the same value. If I add some comment to one (e.g. //
) it works as expected.
Running parcel with:
parcel --no-cache ./src/index.html --public-url=/reacttest --no-hmr
Perhaps the code could be collapsed for space saving purposes, but it still needs to be executed individually.
Similar files are merged and eliminated and executed only once.
Ideally do not eliminate similar files, or ensure they are executed individually.
This breaks basic behavior in react-bootstrap related to CardContext
and AccordionContext
.
A duplicate of #3368.
I think it's severe enough to deserve a fix on 1.x branch.
(The relevant function:
https://github.com/parcel-bundler/parcel/blob/fe08980a6f256d94100d017e7c1f1e0b3a527ec0/packages/core/parcel-bundler/src/Asset.js#L227-L229
this.name
or this.relativeName
could also be factored in
)
Agreed that this is worth fixing on 1.x. This issue has cost me several days in troubleshooting.
Most helpful comment
Agreed that this is worth fixing on 1.x. This issue has cost me several days in troubleshooting.