Parcel: Parcel 2: Wrong dist path in serve mode

Created on 3 Sep 2019  ยท  1Comment  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

When using the serve mode, the output path is wrong

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

{
  "main": "lib/index.js",
  "module": "lib/module.js",
  "browser": "lib/browser.js",
  "source": ["src/index.ts", "src/cli/index.ts"],
  "targets": {
    "main": {
      "node": ">=10.5.0",
      "browsers": "last 1 Chrome versions"
    }
  },
  "scripts": {
    "dev": "parcel watch src/index.ts src/index2.ts",
    "dev2": "parcel src/index.ts src/index2.ts",
    "dev3": "parcel watch src/index.ts",
    "dev4": "parcel serve src/index.ts"
  },
  "dependencies": {
    "parcel": "^2.0.0-alpha.1.1"
  }
}

๐Ÿค” Expected Behavior

The serve mode should use the same output path as the watch mode, which are specified in the main, module and browser package.json properties.

๐Ÿ˜ฏ Current Behavior

The serve mode currently outputs in the .parcel-cache/dist folder

๐Ÿ’ป Code Sample

parcel watch src/index.ts outputs to lib/index.js
parcel serve src/index.ts outputs to .parcel-cache/dist/index.js

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | ^2.0.0-alpha.1.1
| Operating System | Windows 10

Question โœจ Parcel 2

Most helpful comment

This was done intentionally because serve mode works differently from the other modes: only one target is built, and we use a different set of browsers. So, it doesn't really match any of the targets you configure for production. Therefore, we couldn't know which of them to output to. Putting the dist for development inside the cache also ensures that you don't accidentally commit it since .parcel-cache will usually be in .gitignore.

>All comments

This was done intentionally because serve mode works differently from the other modes: only one target is built, and we use a different set of browsers. So, it doesn't really match any of the targets you configure for production. Therefore, we couldn't know which of them to output to. Putting the dist for development inside the cache also ensures that you don't accidentally commit it since .parcel-cache will usually be in .gitignore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dsky1990 picture dsky1990  ยท  3Comments

davidnagli picture davidnagli  ยท  3Comments

philipodev picture philipodev  ยท  3Comments

urbanhop picture urbanhop  ยท  3Comments

jzimmek picture jzimmek  ยท  3Comments