parcel: Absolute and tilde paths doesn't work

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 😃

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@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.

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

@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.

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