Only transform input file and keep index.html untouched.
ultimateshadsform opened this issue · 1 comments
ultimateshadsform commented
Hello! Sorry for being an idiot but I can't for the life of me to figure out on how to tell Vite or rollup to only transform src/entry-server.ts
Here is my Vite config:
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
ssr: {
noExternal: true,
},
build: {
emptyOutDir: true,
rollupOptions: {
input: "src/entry-server.ts",
output: {
format: "cjs",
},
},
},
});
But for some reason it completely deletes the index.html from the output and replaces my client with server code and deletes my index.html.
I have no idea if this is a bug or what.
How can I tell it to only transform src/entry-server.ts and just transform client like normal and eject a normal vite index.html in client?
Because now it just fs the whole client up.
I need the src/entry-server.ts
to be output as cjs format but keep index.html like normal.
ultimateshadsform commented
I was an idiot.
I needed to set it like this:
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
ssr: {
noExternal: true,
target: "webworker",
},
build: {
emptyOutDir: true,
},
});