-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed as not planned
Description
i have my own opinions where my files should be (especially index.html)
so i have custom paths for root, publicDir, build.outDir, build.rollupOptions.input, server.open
to debug broken paths (when index.html is not found)
it would be helpful if the dev server could show a directory listing of available dirs and files
maybe implement with vite dev server in middleware mode?
wrapped in a small http server, something like polka and sirv (20 KB bundle), but with a koa-style interface
also, here is my (working) opinionated vite.config.js
Details
import { defineConfig } from "vite";
import { resolve } from "path";
//import solidPlugin from "vite-plugin-solid";
const abspath = relpath => resolve(__dirname, relpath);
export default defineConfig({
plugins: [
//solidPlugin(), // solidJS framework
],
root: abspath('src/demo'),
base: "./", // relative asset paths for github-pages etc
//publicDir: abspath('public'),
build: {
target: "esnext",
polyfillDynamicImport: false,
outDir: abspath('dist'),
emptyOutDir: true, // force clean
assetsDir: '',
rollupOptions: {
input: {
'demo': abspath('src/demo/index.html'),
}
},
},
server: {
open: '/index.html', // relative to root
},
});folder layout
find . -name .git -prune -o -name node_modules -prune -o -type f -printf '%P\n'
package.json
LICENSE
src/demo/index.js
src/demo/index.html
README.md
dist/vendor.732dfc10.js
dist/demo.280cc842.js
dist/index.html
vite.config.js
Reactions are currently unavailable