Parcel: Parcel 2 : set publicUrl without creating subfolder

Created on 27 Feb 2020  ·  4Comments  ·  Source: parcel-bundler/parcel

❔ Question

I have 2 html files index.html and popup.html using the same javascript file.
I am trying to set publicUrl to "./" for both html files but I can not seem to do it without creating a subfolder in the dist folder.

💻 Code Sample

Here is my parcel command :
parcel watch src/index.html src/popup.html
Here is my targets :

  "targets": {
    "default": {
      "publicUrl": "./"
    }
  },

Right now it is creating a default subfolder in the dist folder, which I would like to prevent. I would like index.html and popup.html in the dist folder.
I tried playing with targets configuration but can not achieve this.

🌍 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 2.0.0-alpha.3.2
| Node | 10.16.0
| npm/Yarn | 1.21.1
| Operating System | macOS

Bug ✨ Parcel 2

Most helpful comment

@mischnic the cli flag isn't working for me:
error: unknown option `--public-url'
(2.0.0-alpha.3.2)

All 4 comments

This works:

"targets": {
  "": {
    "publicUrl": "./"
  }
}

The CLI flag from 1.x seemed better for this simple case

@gpoitch
I would call that a bug, but
parcel build --public-url ./ works for Parcel 2 as well.

@mischnic the cli flag isn't working for me:
error: unknown option `--public-url'
(2.0.0-alpha.3.2)

We really need to release a new alpha.... only in yarn add parcel@nightly for now...

Was this page helpful?
0 / 5 - 0 ratings