parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.43k stars 2.26k forks source link

`watch` combined with `--target` does not build according to the target's options #8105

Closed gillyspy closed 1 year ago

gillyspy commented 2 years ago

🐛 bug report

watch combined with --target does not build according to the target's options

🎛 Configuration (.babelrc, package.json, cli command)

see sampe below

// defaults

🤔 Expected Behavior

I would expect these two commands to generate the same output:

😯 Current Behavior

the build command works as expected from the target's options but the watch does not use them

💁 Possible Solution

not sure

🔦 Context

i can't use watch

i think the expected behaviour is pretty MVP

💻 Code Sample

ane example target i have is:

...
"targets" : {
"restartTask": {
      "context": "browser",
      "source": ["code/scomefile.js"],
      "distDir": "dist/somefolder",
      "outputFormat": "global",
      "engines": {
        "browsers": "Chrome 72"
      },
      "optimize": false
    },
}

🌍 Your Environment

Software Version(s)
Parcel 2.4
Node 17.1
npm/Yarn 8.1.2
Operating System osx 12.0.1
sarahrobichaud commented 2 years ago

Same Issue here

It works with build but not server nor watch.

🎛 Configuration (.babelrc, package.json, cli command)

{
 "scripts": {
    "watch-js": "parcel serve --target resources",
    "build-js": "parcel build --target resources",
    "watch": "concurrently -n w-tailwind,w-js -c cyan,yellow \"npm run watch-tailwind\" \"npm run watch-js\"",
    "build": "npm run build-tailwind && npm run build-js"
  },
}

🔦 Context

I want to compile target resources into /dist/resources.

💻 Code Sample

{
 "targets": {
    "resources": {
      "source": [
        "resources/resources.html"
      ],
      "publicUrl": "dist/resources/",
      "distDir": "dist/resources",
      "engines": {
        "browsers": "> 1%"
      }
    }
  },
}

🌍 Your Environment

Software Version(s)
Parcel 2.6.0
Node 16.13.1
npm/Yarn 8.5.5
Operating System Windows 11(21H2)
ericbiewener commented 2 years ago

I'm also experiencing this. Here's a reproduction repo.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.