🐛 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 |
🐛 bug report
🎛 Configuration
package.json:cli command:
parcel src/pages/index.html💻 Code Sample
src/pages/index.html🤔 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.pngin the img tag should look for the image file atsrc/images/room.pngsincesrc/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:Anyone has an idea about why this would be happening ? Also how do I set the root directory for absolute paths ?
🌍 My Environment