Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix RawAsset loading. #160

Merged
merged 5 commits into from
Dec 11, 2017
Merged

Fix RawAsset loading. #160

merged 5 commits into from
Dec 11, 2017

Conversation

rakannimer
Copy link
Contributor

@rakannimer rakannimer commented Dec 9, 2017

Hello !

Fixes :

jaredpalmer/react-parcel-example#6 #96 #186

Problem :

In RawAsset, the generated bundle name was not prepended by the public url.

This solution :

Prepend RawAsset generated bundle name with options.publicURL (defaults to dist). Updated tests to reflect the change.

Tests :

Passing. I also, tested my fork against https://github.com/jaredpalmer/react-parcel-example and it works in both dev and prod mode.

Thanks for the great work on Parcel ! 👍
Please feel free to close if this code affects other parts negatively.

@rakannimer rakannimer changed the title Prepend RawAsset generated bundle name from --public-url and default to dist. Fix RawAsset loading. Dec 9, 2017
@@ -6,8 +6,11 @@ class RawAsset extends Asset {
load() {}

generate() {
const pathToAsset = JSON.stringify(
path.join(this.options.publicURL, this.generateBundleName())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this cause a \ to be used on windows instead of /?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up. On it.

Copy link
Contributor Author

@rakannimer rakannimer Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I had misunderstood how modules are loaded. Thanks for the review !

@@ -6,8 +6,11 @@ class RawAsset extends Asset {
load() {}

generate() {
const pathToAsset = JSON.stringify(
path.join(this.options.publicURL, this.generateBundleName())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devongovett devongovett merged commit 51b90d7 into parcel-bundler:master Dec 11, 2017
@drejohnson
Copy link

Not sure if this was supposed to fix images not loading in dev environment but I'm still having this issue on v1.2.0

@davidnagli
Copy link
Contributor

@drejohnson I think you should make a new issue or comment on one of the closed ones if they pertain to the bug your experiencing. We definitely need to look into this if it’s still a problem!

Sent with GitHawk

devongovett pushed a commit that referenced this pull request Oct 15, 2018
* Prepending raw asset generated bundle name with publicURL.

* Working code. Failing tests.

* Fix whoops.

* Back to working.

* Resolve Raw Asset URL instead of path.
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* Prepending raw asset generated bundle name with publicURL.

* Working code. Failing tests.

* Fix whoops.

* Back to working.

* Resolve Raw Asset URL instead of path.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants