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

🐛 link to static html could'not be resolved, win10, parcel 1.0.3 #86

Closed
lifeart opened this issue Dec 7, 2017 · 17 comments · Fixed by #850
Closed

🐛 link to static html could'not be resolved, win10, parcel 1.0.3 #86

lifeart opened this issue Dec 7, 2017 · 17 comments · Fixed by #850

Comments

@lifeart
Copy link

lifeart commented Dec 7, 2017

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


@brandon93s
Copy link
Contributor

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

@davidnagli
Copy link
Contributor

@brandon93s Do you wanna take this issue?

@davidnagli
Copy link
Contributor

Is this still a problem after #197 got merged?

I think it should fix it, but I don’t have windows so I can’t test it.

@lifeart
Copy link
Author

lifeart commented Dec 11, 2017

@dannify what if this file not exists on build time (html file link) ?

@brandon93s
Copy link
Contributor

Is this still a problem after #197 got merged?

I think it should fix it, but I don’t have windows so I can’t test it.

Tested against current master; this is not fixed.

@DeMoorJasper DeMoorJasper changed the title link to static html could'not be resolved, win10, parcel 1.0.3 🐛 link to static html could'not be resolved, win10, parcel 1.0.3 Dec 13, 2017
@mix3d
Copy link

mix3d commented Dec 18, 2017

Having the same problem with absolute paths in CSS files, which is a common approach to web development. Looking forward to PR #290

@ajmcgarry
Copy link

ajmcgarry commented Dec 18, 2017

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"

@davidnagli
Copy link
Contributor

@ajaymathur Hang tight, #290 will fix this issue once it get’s released :)

@mix3d
Copy link

mix3d commented Jan 2, 2018

@davidnagli seems like it's a bigger problem than expected

@devongovett
Copy link
Member

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?

@mix3d
Copy link

mix3d commented Jan 3, 2018

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.

@devongovett
Copy link
Member

@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)?

@mix3d
Copy link

mix3d commented Jan 4, 2018

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?

@ajmcgarry
Copy link

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.

@nodkrot
Copy link

nodkrot commented Jul 7, 2018

+1

@joallard
Copy link

Still getting this in 1.9.6 on first use.

@kleinfreund
Copy link

kleinfreund commented Aug 21, 2018

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'

gorakong pushed a commit that referenced this issue Nov 3, 2022
Add tracing measurements to phases in Parcel

Approved-by: Niklas Mischkulnig
Approved-by: Marcin Szczepanski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants