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`
|
? `${serverHttpCertBase}.crt`
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
const isTestBuild = ["development", "staging"].includes(mode);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
suid(),
|
suid(),
|
||||||
|
@ -101,6 +103,10 @@ export default defineConfig(({ mode }) => {
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
},
|
},
|
||||||
|
esbuild: {
|
||||||
|
pure: isTestBuild ? undefined : ["console.debug", "console.trace"],
|
||||||
|
drop: isTestBuild ? undefined : ["debugger"],
|
||||||
|
},
|
||||||
define: {
|
define: {
|
||||||
"import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,
|
"import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue