StarkShang / vite-plugin-chrome-extension

A vite plugin to bundle chrome extensions for Manifest V3.
MIT License
467 stars 68 forks source link

empty build being generated when running `vite build --watch` #6

Open infix opened 3 years ago

infix commented 3 years ago

Explanation:

when running vite build --watch, it initially builds correctly. However, after the first change to generates an empty build

Codesandbox reproduction: https://codesandbox.io/s/vite-plugin-chrome-extension-watch-build-bug-py0nd?file=/src/main.tsx

Reproduction steps:

  1. open the code sandbox link
  2. run yarn start (vite build --watch) and check the /dist directory. you'll notice that it's built correctly 09
  3. change <div>Hello World</div> in main.tsx to <div>Hello</div>
  4. check the /dist dir again you will notice that only 2 files are generated manifest.js and manifest.json

Build log:

build started...

Find entry files
main: src/main.tsx

✓ 22 modules transformed.
dist/manifest.json        0.13kb
dist/index.html           0.28kb
dist/main.js              0.12kb / brotli: 0.09kb
dist/vendor.6ad9ec51.js   127.61kb / brotli: 36.10kb
built in 6251ms.

build started...

Find entry files
src/manifest.json

✓ 23 modules transformed.
Generated an empty chunk: "manifest"
dist/manifest.json   0.13kb
dist/manifest.js     0.00kb / brotli: 0.00kb
built in 64ms.

Thank you for this great plugin, please let me know if there's anything I can do to help :)

StarkShang commented 3 years ago

Indeed --watch option is not available now, and it is in the current work. I will make it work normally as soon as possible.

infix commented 3 years ago

Thank you :). if it's possible I'd like to help by contributing code, but I don't know if I'll be free before the weekend

shmarts commented 3 years ago

+1 for this! loving this package but supporting --watch would be perfect

farzadso commented 3 years ago

Any updates on this? Is there any way we could help?

DavidShefcik commented 3 years ago

+1

farzadso commented 3 years ago

@infix Can we please have an update on this?

farzadso commented 3 years ago

Is this issue dead?

floer32 commented 3 years ago

I want to help troubleshoot this but I'm not sure where to start.

dipsaus9 commented 3 years ago

If I can help in any way please let me know.

Jay214 commented 3 years ago

Indeed --watch option is not available now, and it is in the current work. I will make it work normally as soon as possible.

Hello, can you fix this as soon as possible, it would be very useful

boka18 commented 3 years ago

+1

Hey @StarkShang, it would be great if we can get any update on this. Thanks!

i8ramin commented 3 years ago

Here is a workaround that seems to work using npm-watch.

In my package.json file I have the following:

  "watch": {
    "build": {
      "patterns": [
        "src"
      ],
      "extensions": "ts,svelte,html",
      "runOnChangeOnly": false
    }
  },
  "scripts": {
    "build": "vite build",
    "watch": "npm-watch"
  },

And then I simply run yarn watch (or npm run watch)

farzadso commented 3 years ago

Thanks, @i8ramin Better than nothing.

atwright147 commented 2 years ago

I am also interested in this

mismith commented 2 years ago

I wasn't happy with the npm-watch solution. @StarkShang I think you are probably very busy or have moved on from this project, but maybe you could point where to where in the code you think I would need to adjust to support --watch and I could potentially open a PR for this? Or even just a rough sketch for how you think you would tackle solving this? Thanks!

McSam94 commented 2 years ago

is there any update on this matter?

noahBin23 commented 2 years ago

Looking forward to this feature, when will it be supported?