index.html
<p>
<a href="/src/somePathToChecker/index.html">Check</a>
</p>
Cannot resolve dependency './..\..\..\..\..\src\somePathToChecker\index.html'
at C:\Users\Aleksandr_Kanunnikov\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\browser-resolve\node_modules\resolve\lib\async.js:55:21
at load (C:\Users\Aleksandr_Kanunnikov\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (C:\Users\Aleksandr_Kanunnikov\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
at C:\Users\Aleksandr_Kanunnikov\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
This issue is related to absolute paths. @lifeart if you're able to use relative paths, that should get you up and running until there is a fix (e.g. href="src/..."
).
Issue is occurring in addUrlDependency
: https://github.com/parcel-bundler/parcel/blob/master/src/Asset.js#L64-L84
@brandon93s Do you wanna take this issue?
Is this still a problem after #197 got merged?
I think it should fix it, but I don鈥檛 have windows so I can鈥檛 test it.
@dannify what if this file not exists on build time (html file link) ?
Is this still a problem after #197 got merged?
I think it should fix it, but I don鈥檛 have windows so I can鈥檛 test it.
Tested against current master; this is _not_ fixed.
Having the same problem with absolute paths in CSS files, which is a common approach to web development. Looking forward to PR #290
Same issue.
Any reference to a static resource using a site root location fails with "Cannot resolve dependency" errors
Examples
CSS file
src: url("/assets/fonts/.....")
HTML file
href="/favicon.png"
@ajaymathur Hang tight, #290 will fix this issue once it get鈥檚 released :)
@davidnagli seems like it's a bigger problem than expected
So, we have two different approaches to basically the same problem: how to reference files starting at the root of a module. This issue proposes using absolute paths (e.g. /foo/bar.js
), but #336 proposes using tilde: e.g. ~/foo/bar.js
. Not sure we should support two ways to do the same thing. What do we think? Are there plusses and minuses to each?
for a "zero config" bundler, it ABSOLUTELY should handle absolute path correctly. There's no way around it. If you have to change your references to a breaking design, ie it won't run without being bundled, then you've lost the core argument for parcel.
At least for the root of a project. I know the npm module thing is a concern, but you shouldn't have to change npm modules just to make their relative roots work either.
@mix3d what would you expect /
to resolve to? The root of the filesystem (like on unix), the root of the project, or the root of the current module (e.g. in node_modules)?
I guess I'm not familiar enough with modules, but if I have an existing project who's / root is the root of the project, like how it would be served over http, that's how I'd expect it to work. I don't have to change anything between serving code as-is and bundling.
Node module imports are clearly an issue though, because if they are referencing / as their module's root, things get tricky. How does webpack handle this?
Right now Parcel cannot package a simple static site which uses nothing but html and some other assets which are referenced as site root "/" in either HTML or CSS. Shouldn't this be the simplest case and work forward from there.
+1
Still getting this in 1.9.6 on first use.
This is still an issue, no?
~/dev/repos/test
$ parcel build _site/index.html --out-dir build
馃毃 /home/phil/dev/repos/test/_site/index.html: Cannot resolve dependency
'/home/phil/dev/repos/test/_site/css/test.css' at
'/home/phil/dev/repos/test/_site/css/test.css'
Most helpful comment
Right now Parcel cannot package a simple static site which uses nothing but html and some other assets which are referenced as site root "/" in either HTML or CSS. Shouldn't this be the simplest case and work forward from there.