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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix absolute and tilde paths #1324

Merged
merged 2 commits into from
May 23, 2018

Conversation

marcosbozzani
Copy link
Contributor

@marcosbozzani marcosbozzani commented May 8, 2018

Fix addURLDependency resolution in Asset.js

Minimal reproducible repo: https://github.com/marcosbozzani/parcel-bug-tilde-abs-paths

Just clone the repo, yarn install and yarn tilde or yarn slash

Tilde error: Cannot resolve dependency './~\style.css'
Slash error: Cannot resolve dependency './..\..\..\..\..\..\

@codecov-io
Copy link

Codecov Report

Merging #1324 into master will decrease coverage by 0.72%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1324      +/-   ##
==========================================
- Coverage   88.41%   87.68%   -0.73%     
==========================================
  Files          80       80              
  Lines        4584     4532      -52     
==========================================
- Hits         4053     3974      -79     
- Misses        531      558      +27
Impacted Files Coverage Δ
src/Asset.js 99.18% <100%> (+0.07%) ⬆️
src/visitors/fs.js 78.1% <0%> (-13.14%) ⬇️
src/utils/promisify.js 88.88% <0%> (-11.12%) ⬇️
src/visitors/globals.js 89.47% <0%> (-5.27%) ⬇️
src/assets/VueAsset.js 80% <0%> (-4.25%) ⬇️
src/utils/installPackage.js 89.65% <0%> (-3.75%) ⬇️
src/utils/pipeSpawn.js 92.3% <0%> (-3.15%) ⬇️
src/assets/HTMLAsset.js 86.13% <0%> (-2.98%) ⬇️
src/assets/TypeScriptAsset.js 97.29% <0%> (-2.71%) ⬇️
src/visitors/dependencies.js 88.88% <0%> (-2.57%) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87b1ea9...de2ef7b. Read the comment docs.

Copy link

@houd1ni houd1ni left a comment

Choose a reason for hiding this comment

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

LGFM. I cannot believe, it completely did not work after #850

Copy link
Member

@DeMoorJasper DeMoorJasper left a comment

Choose a reason for hiding this comment

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

Some assets already have their own resolver instance. Could you clean this up a bit and remove those, and reference them to this.resolver instead of creating their own. (As your Pr adds one to the asset instance, they no longer need to create one themselves, they can utilise the one in asset)~

I think the ones with their own resolver instance are SASS, LESS and Stylus

EDIT: On second thought this could probably break on css imports that don't define an extension, what do you think?

@marcosbozzani
Copy link
Contributor Author

Maybe I can create a logic that checks whether the assets already has a resolver or else use the default one.
I'll analyse the code and try to come up with a solution.

Copy link
Member

@DeMoorJasper DeMoorJasper left a comment

Choose a reason for hiding this comment

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

I've had a little chat with @fathyb about the possible side-effects of my remark and it's probably a better idea to keep this as is.
So feel free to ignore my previous requested changes.

@DeMoorJasper DeMoorJasper merged commit 1614918 into parcel-bundler:master May 23, 2018
@absentees
Copy link

@marcosbozzani does this work for you now? I'm still getting the same errors on your example repo, and on my own.

@viztor
Copy link

viztor commented Jul 30, 2018

still getting the same errors

devongovett pushed a commit that referenced this pull request Oct 15, 2018
Fix addURLDependency resolution in Asset.js

Minimal reproducible repo: https://github.com/marcosbozzani/parcel-bug-tilde-abs-paths

Just clone the repo, `yarn install` and `yarn tilde` or `yarn slash`

Tilde error: `Cannot resolve dependency './~\style.css'`
Slash error: `Cannot resolve dependency './..\..\..\..\..\..\`
devongovett pushed a commit that referenced this pull request Oct 15, 2018
Fix addURLDependency resolution in Asset.js

Minimal reproducible repo: https://github.com/marcosbozzani/parcel-bug-tilde-abs-paths

Just clone the repo, `yarn install` and `yarn tilde` or `yarn slash`

Tilde error: `Cannot resolve dependency './~\style.css'`
Slash error: `Cannot resolve dependency './..\..\..\..\..\..\`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants