vite: remove console and debugger stmts in prod
This commit is contained in:
parent
93f98059cd
commit
7bb6c0b826
1 changed files with 6 additions and 0 deletions
|
@ -62,6 +62,8 @@ export default defineConfig(({ mode }) => {
|
|||
? `${serverHttpCertBase}.crt`
|
||||
: undefined;
|
||||
|
||||
const isTestBuild = ["development", "staging"].includes(mode);
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
suid(),
|
||||
|
@ -101,6 +103,10 @@ export default defineConfig(({ mode }) => {
|
|||
}
|
||||
: undefined,
|
||||
},
|
||||
esbuild: {
|
||||
pure: isTestBuild ? undefined : ["console.debug", "console.trace"],
|
||||
drop: isTestBuild ? undefined : ["debugger"],
|
||||
},
|
||||
define: {
|
||||
"import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue