vite-ssg
vite-ssg copied to clipboard
My production builds are going to dev mode
Describe the bug
I was checking my production code in chrome dev tools and noticed that the Vue extension was enabled and showing all the details.
my vite.config.ts
import { fileURLToPath, URL } from "url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import ssgOptions from "vite-ssg";
import generateSitemap from "vite-ssg-sitemap";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
build: {
manifest: true,
minify: "esbuild",
},
ssgOptions: {
mock: true,
script: "async",
formatting: "minify",
onFinished() {
generateSitemap();
},
},
});
Am I doing anything wrong here?
I'm building with npm run dev
which runs npx vue-tsc --noEmit && vite-ssg build
Reproduction
will add
System Info
System:
OS: Windows 10 10.0.22621
CPU: (6) x64 AMD Ryzen 5 3500X 6-Core Processor
Memory: 8.15 GB / 15.95 GB
Binaries:
Node: 18.4.0 - C:\Program Files\nodejs\node.EXE
npm: 9.3.0 - D:\<PROJECT>\node_modules\.bin\npm.CMD
Browsers:
Edge: Spartan (44.22621.755.0), Chromium (109.0.1518.70)
Internet Explorer: 11.0.22621.1
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [ ] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [ ] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [ ] The provided reproduction is a minimal reproducible of the bug.
Found a discussion thread about this #329 . closing this now
UPDATE: THE DISCUSSION THREAD IS STALE
Leaving my solution here as well
modify your "build" script to explicitly set node to production mode
Windows
"build": "set NODE_ENV=production&& vite-ssg build",
Linux
"build": "export NODE_ENV=production && vite-ssg build",