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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

./../../../../../../ Added to an absolute path #1024

Closed
dolma opened this issue Mar 18, 2018 · 4 comments
Closed

./../../../../../../ Added to an absolute path #1024

dolma opened this issue Mar 18, 2018 · 4 comments

Comments

@dolma
Copy link

dolma commented Mar 18, 2018

馃悰 bug report

馃帥 Configuration

package.json:

{
  "devDependencies": {
    "autoprefixer": "^7.2.4",
    "node-sass": "^4.7.2",
    "parcel-bundler": "^1.6.2",
    "postcss-modules": "^1.1.0"
  },
}

cli command: parcel src/pages/index.html

馃捇 Code Sample

src/pages/index.html

<img src="/images/room.png"/>

馃 Expected Behavior

Basically I'd just like to have my src/ directory as the root directory of my project and be able to use absolute paths that would originate from this root directory.

In this case, using /images/room.png in the img tag should look for the image file at src/images/room.png since src/ is the root path.

馃槸 Current Behavior

Instead, it adds a ton of ../ tokens to the path when it is defined as an absolute path. I know I did not define the root directory because I have no idea how. Looked through the "docs" and throughout the github issues and couldn't find any indication of it. I would assume that it's possible to set it in the options (since it's a very basic feature) but can't find how.

Regardless of setting the root path, it still doesn't make sense to me why the path gets prepended with all these ../. I would expect it to tell me it can't find the resource, but not modify the path in such a weird way. Here's the error message I get:

馃毃  /[PROJECT]/src/pages/index.html: Cannot resolve dependency './../../../../../../images/room.png' at '/images/room.png'
    at /[PROJECT]/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
    at load (/[PROJECT]/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/[PROJECT]/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /[PROJECT]/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:166:21)

Anyone has an idea about why this would be happening ? Also how do I set the root directory for absolute paths ?

馃實 My Environment

Software Version(s)
Parcel 1.6.2
Node 9.3.0
yarn 1.3.2
Operating System macOS High Sierra
@devongovett
Copy link
Member

absolute paths will be supported by the new resolver in v1.7.0 - #850. Will be released soon.

@dolma
Copy link
Author

dolma commented Mar 18, 2018

Oh thanks ! Good to know. I'll be patiently waiting for the new release then ;)

@ghost
Copy link

ghost commented Mar 21, 2018

Oh thanks ! Good to know. I'll be patiently waiting for the new release then ;) +1

@kawamurakazushi
Copy link

I guess the absolute path is still not working for HTML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants