Parcel: Problem with "/" path

Created on 1 May 2018  路  2Comments  路  Source: parcel-bundler/parcel

Choose one: 馃悰 bug report

馃帥 Configuration (.babelrc, package.json, cli command)

{ "name": "sample", "version": "1.0.0", "main": "index.js", "scripts": { "dev": "parcel src/index.html -p 8080 --open", "build": "parcel build src/index.html" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "autoprefixer": "^8.4.1", "babel-cli": "^6.26.0", "babel-preset-env": "^1.6.1", "css-mqpacker": "^6.0.2", "jquery": "^3.3.1", "node-sass": "^4.9.0", "parcel-bundler": "^1.7.1", "parcel-plugin-bundle-manifest": "^0.1.1", "postcss": "^6.0.22", "swiper": "^4.2.2" }, "description": "" }

馃 Expected Behavior

When I build the site, the paths are correct except that there is a"/" at the beginning, which refers to the root of my computer.

Example: /page.html instead of page.html only

馃槸 Current Behavior

It adds the / at the beginning of my links (css, js, etc...). Which is broke my website.

馃拋 Possible Solution

Be able to remove the / at the beginning of the access roads.

馃敠 Context

I tried to compile my site with the command parcel build src/index.html.

馃捇 Code Sample

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.7.1
| Node | v10.0.0
| npm/Yarn | 5.6.0
| Operating System | macOS 10.13.4 (17E202)

Question

Most helpful comment

use the following command:
parcel build src/index.html --public-url ./

The default is /, therefore absolute paths

All 2 comments

use the following command:
parcel build src/index.html --public-url ./

The default is /, therefore absolute paths

It works! Thanks :)

Was this page helpful?
0 / 5 - 0 ratings