Skip to content

Commit

Permalink
chore: remove console and debugger when not in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
keiko233 committed Feb 28, 2024
1 parent 11d7241 commit d884426
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,33 @@ import monaco from "vite-plugin-monaco-editor";
import svgr from "vite-plugin-svgr";

// https://vitejs.dev/config/
export default defineConfig({
root: "src",
server: { port: 3000 },
plugins: [
svgr(),
react(),
monaco({ languageWorkers: ["editorWorkerService", "typescript"] }),
],
esbuild: {
drop: ["console", "debugger"],
},
build: {
outDir: "../dist",
emptyOutDir: true,
},
resolve: {
alias: {
"@": path.resolve("./src"),
"@root": path.resolve("."),
export default defineConfig(({ command }) => {
const isDev = command === "serve";

return {
root: "src",
server: { port: 3000 },
plugins: [
svgr(),
react(),
monaco({ languageWorkers: ["editorWorkerService", "typescript"] }),
],
esbuild: {
drop: isDev ? undefined : ["console", "debugger"],
},
build: {
outDir: "../dist",
emptyOutDir: true,
},
resolve: {
alias: {
"@": path.resolve("./src"),
"@root": path.resolve("."),
},
},
define: {
OS_PLATFORM: `"${process.platform}"`,
WIN_PORTABLE: !!process.env.VITE_WIN_PORTABLE,
},
},
define: {
OS_PLATFORM: `"${process.platform}"`,
WIN_PORTABLE: !!process.env.VITE_WIN_PORTABLE,
},
};
});

0 comments on commit d884426

Please sign in to comment.