Closed surmon-china closed 3 years ago
Watch support for build
would also be super useful when working on legacy bundles (via vite-plugin-legacy
).
I can submit a pull request to implement this feature.
@yyx990803 @antfu @underfin
vite build --watch
(defaulted to dev mode) will be very invaluable...
Similar to.. @surmon-china
vite build --watch --hmr
like snowpack (https://github.com/snowpackjs/snowpack/issues/1002) would be the ultimate...
@surmon-china any updates on the PR?
I've taken a look at Vite source and I agree this would be a pretty simple change. Basically, Rollup should just run rollup.watch
instead of rollup.rollup
if we are in NODE_ENV=development
mode. From there, I think we would be able to add the standard watch options via the existing rollup options.
I would do the PR myself but I can't figure out exactly how I'm supposed to run the playground, testing, and dev server to create an acceptable result... For someone experienced with the codebase, any thoughts?
watch
support for build would also be super useful when you develop electron app.
Any update on this feature?
Closing to track in #1290 & #1434
Feature
I am using vite to build an SSR website, during which I tried to implement a nuxt-like, faster SSR framework, but I need better support.
I wish
build
andssrBuild
can supportwatch
mode, or there bewatchBuild
andwatchSSRBuild
functionsSSR inevitably requires real-time compilation of products (Client & Server)
In my test.
First, a form of
fileWatcher(files, () => build().then(() => restart()))
is used to track file changes and execute compile, but this will do a fullbuild
without cache support, which takes a long time.Second. If you use
rollup.watch
to compile, you can quickly update the product and achieve a better development experience.However, the implementation of the
build
function in the vitesrc/node/build/index.ts:build
file is too complex and deeply coupled, and I have to re-implement it externally, so I hope this can be extracted as a single function.links
rollup.watch & write
roolup watch.skipWrite option