Skip to content
New issue

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

Parcel not using --public-url when resolving bundles via code-splitting #2433

Closed
rhurstdialpad opened this issue Dec 18, 2018 · 3 comments
Closed

Comments

@rhurstdialpad
Copy link
Contributor

rhurstdialpad commented Dec 18, 2018

馃悰 bug report

When generating code with parcel that contains dynamic imports (code splitting) the expected path of secondary bundles is always expected to be at the root path and ignores the --public-url flag.

Update: It turns out that parcel uses a stack trace to resolve the path to the primary bundle, then uses this to determine the base path of secondary bundles. However this only works with files loaded from protocols http://, https://, 'ftp://', and 'file://'. I've created a pull request to support the chrome-extension:// protocol.

馃 Expected Behavior

I expected parcel's module system to attempt to fetch the bundle with the value of --public-url as a prefix to the name of the bundle file.

馃槸 Current Behavior

Parcel's module system tries to fetch the bundle as if the secondary bundle is at the root path not taking --public-url into account.

馃拋 Possible Solution

Ideally Parcel's module system should fetch the bundle from the subpath of --public-url

馃敠 Context

Bundling source in a chrome app where file paths are relative to the filesystem inside the chrome app.

馃實 Your Environment

Software Version(s)
Parcel 1.11.0
Node 10.11.0
npm/Yarn yarn 1.12.1
Operating System macOS 10.14.1
@rhurstdialpad
Copy link
Contributor Author

Figured it out. It's because chrome extensions and apps use a custom protocol chrome-extension which does not match the regex parcel uses to get the path of the current bundle.

See here => https://github.com/parcel-bundler/parcel/blob/master/packages/core/parcel-bundler/src/builtins/bundle-url.js#L15-L25

@rhurstdialpad
Copy link
Contributor Author

rhurstdialpad commented Dec 18, 2018

I've created a pull request that adds the protocol here => #2434

@rhurstdialpad
Copy link
Contributor Author

PR was merged, closing this as a result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant