Files
django_vite_skel/frontend/vite.config.js

48 lines
1.0 KiB
JavaScript

import {defineConfig, loadEnv} from "vite";
import {resolve, join} from "path";
// const postcssConfig = {
// plugins: [
// require('postcss-import')(),
// require('postcss-simple-vars')(),
// require('autoprefixer')(),
// ],
// };
export default defineConfig((mode) => {
const env = loadEnv(mode, "..", ""),
SRC_DIR = resolve("./src"),
OUT_DIR = resolve("./dist")
return {
plugins: [
],
resolve: {
alias: {
"@": resolve(SRC_DIR)
}
},
root: SRC_DIR,
base: "/static/",
// css: {
// postcss: postcssConfig
// },
server: {
host: env.DEV_SERVER_HOST,
port: env.DEV_SERVER_PORT,
origin: `http://${env.DEV_SERVER_HOST}:${env.DEV_SERVER_PORT}`, // hotfix, webfont was loaded from wrong url
},
build: {
manifest: "manifest.json",
emptyOutDir: true,
outDir: OUT_DIR,
rollupOptions: {
input: {
home: join(SRC_DIR, "entrypoint/app.js"),
style: join(SRC_DIR, "style/main.css.js")
}
}
}
}
})