Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build --watch doesn't watch files in public #18655

Open
7 tasks done
Skn0tt opened this issue Nov 13, 2024 · 0 comments
Open
7 tasks done

build --watch doesn't watch files in public #18655

Skn0tt opened this issue Nov 13, 2024 · 0 comments

Comments

@Skn0tt
Copy link

Skn0tt commented Nov 13, 2024

Describe the bug

It appears that vite build --watch only copies over public once when initialised, instead of watching them. We expect them to be watched just like other source files.

We use Vite to build a website with a service worker into a static directory, so that our custom HTTP server can pick it up. The website has a service worker and it needs different build settings than the main site. We have a separate vite build --watch --outDir=public --config=vite.sw.config.ts process that does that. We expect the main vite build --watch process to watch file changes in public just like it watches file changes from outher sources, and we expect it to sync those changes into its out dir so our custom HTTP server can pick them up.

Reproduction

https://github.com/Skn0tt/vite-build-watch-public-repro

Steps to reproduce

  1. npm ci
  2. npx vite build --watch
  3. edit contents of public/foo

expected: dist/foo contains updated content

actual: dist/foo contains content old content from when npx vite build --watch was started

System Info

System:
    OS: macOS 15.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 125.64 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.7.0 - ~/.nvm/versions/node/v22.7.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.7.0/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v22.7.0/bin/npm
    pnpm: 9.6.0 - ~/.nvm/versions/node/v22.7.0/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.70
    Edge: 130.0.2849.80
    Safari: 18.1
  npmPackages:
    vite: ^5.4.11 => 5.4.11

Used Package Manager

npm

Logs

No response

Validations

@Skn0tt Skn0tt changed the title build --watch doesn't sync files in public build --watch doesn't watch files in public Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant