Parcel: Absolute and tilde paths doesn't work

Created on 24 Apr 2018  Â·  15Comments  Â·  Source: parcel-bundler/parcel

Related: https://github.com/parcel-bundler/parcel/pull/850#issuecomment-377811893

For example this:

require('/assets/logo.png')
parcel index.html -p 3101

installs the "assets" package for me :)

Question

Most helpful comment

@DeMoorJasper please reopen. this is not fixed. it is horrible looking through all the internet for a solution, and found several times it being mentioned as fixed, then after several times recognizing this as my problem, realizing this was never fixed properly in the first place.

All 15 comments

Disable autoinstall this should throw the correct error u encounter, using --no-autoinstall

Sent with GitHawk

I've just tried with --no-autoinstall, it doesn't attempt to install the assets package anymore and I can see there is path to image in the output html http://localhost:3101/logo.png, but it isn't served by the parcel – 404 Not Found

That's strange is the file being created in the dist directory?

no it isn't, just checked,
maybe I should provide a "minimal reproducible repo" and then open a new issue?

You can comment the repo here, no need to open a new issue

Closing due to inactivity and autoinstall has been fixed

I have the same problem.

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 './..\..\..\..\..\..\

For now, I've patched Asset.js and works for me.

I've also created created a PR with tests: https://github.com/parcel-bundler/parcel/pull/1324

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | parcel 1.8.1
| Node | node v8.9.4
| npm/Yarn | yarn 1.6.0
| Operating System | windows 10 1703

Me too. With ubuntu 18.04, npm 6 and node 9.

The only difference that I use vuejs. And am trying to resolve import something from '~/foo/bar' in /abspath/hello.vue.

It simply puts the tilde to the relative path like this: 'cannot resolve in /abspath/~/foo/bar.js'.

The very similar trouble with paths, that begin with a slash.

is it really a question or a bug? I've done nothing but using a plain parcel to reproduce this in two projects. I even guess, that others just don't use these aliases at all.

@houd1ni it's a verified bug, fixed in #1324. It'll be part of the 1.9 release.

@DeMoorJasper can we keep this open until the fix is released? I've found tracking this problem really difficult because according to all records it has been a feature for ages, with all associated bug reports / feature requests closed, which gives the misleading impression that it should be usable now.

It doesn't seems the issue is fixed in the latest release

@DeMoorJasper please reopen. this is not fixed. it is horrible looking through all the internet for a solution, and found several times it being mentioned as fixed, then after several times recognizing this as my problem, realizing this was never fixed properly in the first place.

This is still not working. Was Parcel 1 abandoned in favor of Parcel 2 development 2 years ago?

@julianeden looks like parcel's issues have been abandoned years ago (:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philipodev picture philipodev  Â·  3Comments

jzimmek picture jzimmek  Â·  3Comments

mnn picture mnn  Â·  3Comments

adamreisnz picture adamreisnz  Â·  3Comments

Niggler picture Niggler  Â·  3Comments