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
The problem I'm trying to solve is that I have one main script as well as one or more feature scripts. Feature scripts are included in index.html depending on the user's role. The main script is always included. Feature scripts need to include components that are defined in the main script.
In other words, a component inside the feature script imports the modal component from the main script. However, as soon as Parcel sees the import in component.ts, it includes modal.ts in the feature script, and now modal.ts exists twice, once in the main script and once in the feature script.
Is there a way to let Parcel know that the feature script should treat modal.ts as a runtime import?
Looking at the parcelRequire function, this appears to be very simple. parcelRequire is already aware of previously loaded bundles and can delegate require calls to them.
I have tried dynamic imports. I have tried bundling main and feature separately as well as together. But whatever I do, I get duplicated code.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The problem I'm trying to solve is that I have one main script as well as one or more feature scripts. Feature scripts are included in index.html depending on the user's role. The main script is always included. Feature scripts need to include components that are defined in the main script.
For example:
In other words, a component inside the feature script imports the modal component from the main script. However, as soon as Parcel sees the import in component.ts, it includes modal.ts in the feature script, and now modal.ts exists twice, once in the main script and once in the feature script.
Is there a way to let Parcel know that the feature script should treat modal.ts as a runtime import?
Looking at the
parcelRequire
function, this appears to be very simple.parcelRequire
is already aware of previously loaded bundles and can delegaterequire
calls to them.I have tried dynamic imports. I have tried bundling main and feature separately as well as together. But whatever I do, I get duplicated code.
Beta Was this translation helpful? Give feedback.
All reactions