Skip to content

Commit

Permalink
feat: add source maps for dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Jul 22, 2022
1 parent c850002 commit c35834d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ VITE_VERSION=
VITE_PRINT_PROXY=
VITE_DISCOVER=
VITE_WEB_API=
VITE_SOURCE_MAPS=true
15 changes: 11 additions & 4 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { defineConfig, loadEnv } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: './',
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());

return {
plugins: [react()],
base: './',
build: {
sourcemap: env.VITE_SOURCE_MAPS,
},
};
});

0 comments on commit c35834d

Please sign in to comment.