-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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 mode #1434
Comments
If I get it, work have to be done here ? I can go for implementation if needed edit: I got something working with rollup.watch here |
This allow the library to be tree-shaken. Since Webpack is not capable of building ES2015 module for libraries [0], it is replaced by Vite [1]. The only inconvenient of this switch is that Vite does not have a build watch mode at the moment [2] so we simulate it using nodemon [3]. Note that we still also deliver the lib as UMD because Jest needs it. Part of request #19287: Make internal libs "tree-shakeable" [0] webpack/webpack#2933 [1] https://vitejs.dev [2] vitejs/vite#1434 [3] https://nodemon.io/ Change-Id: I8341202dec6124c9704e630cbf348d5e02bb6746
@yyx990803 Could you review this PR #1449 , and merge it ASAP? |
I did not get time to finish it yet, I can take time in the end of the week to merge with master and finish it |
Looking forward to this as it'll let me build web extensions with Vite... |
Adding to the chorus excited for this functionality! |
This would be a very useful feature for library mode when building UI components library 🚀 |
Can we use vite to build a chrome extension project?
|
@StarkShang Once #1449 this merged version is live, you can do that. So, on each save, it will trigger a build so you can run the project in the chrome extension local package. |
Thank you very much, @surjithctly. 1. Is Feature build watch mode #1449 works in version 2.1.5? I am using vite@2.1.5, but I get error messages when I add
2. Can I use manifest.json file as input? I am trying to use manifest.json as input. My project has following structure,
And my config is as follows, import { resolve } from "path";
import { defineConfig } from "vite";
import { WatcherOptions } from "rollup";
import vue from "@vitejs/plugin-vue";
const watcherOptions: WatcherOptions = {};
export default defineConfig({
root: resolve(__dirname, "src"),
publicDir: resolve(__dirname, "public"),
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
build: {
outDir: resolve(__dirname, "dist"),
emptyOutDir: true,
watch: watcherOptions,
rollupOptions: {
input: {
manifest: resolve(__dirname, "src/manifest.json"),
options: resolve(__dirname, "src/options/index.html"),
},
},
},
plugins: [
vue(),
],
}); |
No
No. I think it will be easier for set up build of 2-3 html pages input: {
background: resolve(__dirname, "src/background/index.html"),
options: resolve(__dirname, "src/options/index.html"),
}, |
Thanks. @cawa-93 |
Why? I'm not sure it's allowed this now, but before you could set the background page as a html file. and even if it is not allowed now, you can specify the path of the background script. You only need to do this once, because the source file will always be in the same place. If you are bothered by hashes in the file name, you can disable them. UPD {
"background": {
"page": "my-background.html"
}
} |
Thanks for your reply, @cawa-93.
I have tried to using a background.html directly in manifest file as, {
"background": {
"service_worker": "./background.html"
},
} An error with message "Service worker registration failed" is prompted by chrome. |
Why |
This PR was merged, but has not yet been released |
I mean why still not release? 😂 |
The feature has released at v2.2.0, changelog: v2.1.5...v2.2.0 |
Excuse me not to open a new issue, since this is a |
Import SCSS are not considered. Main JS File All.scss File Only changes in the Main JS File and All.scss start the rebuild. Why? My Vite Config:
CLI: vite build --watch |
I can confirm I have the same issue as @JonathanSchndr |
@JonathanSchndr @farzadso could you open a new issue with a reproduction? |
@patak-js
|
development
modeUse Cases
Relevant API
https://rollupjs.org/guide/en/#rollupwatch
The text was updated successfully, but these errors were encountered: