Hi I deploy my react using vite, however all the source code showing from debugger. I want to hide it and already follow the step:
"build": "GENERATE_SOURCEMAP=false vite build",
build: {
outDir: 'build',
chunkSizeWarningLimit: 1600,
assetsDir: './',
rollupOptions: {
input: './src/index.jsx'
},
sourcemap: 'false'
},
sourcemap: {
server: true,
client: true,
},
But all options not working.
Please see this image
I want source code not showing on debugger.
You have to disable source maps. Here's how you can do :
"scripts": {
"build": "GENERATE_SOURCEMAP=false vite build"
}
npm install --save-dev cross-env
"scripts": {
"build": "cross-env GENERATE_SOURCEMAP=false vite build"
}
module.exports = {
build: {
sourcemap: false
}
}
Don't forget to restart your server
You can disable sourcemap in vite.config.ts.
import { defineConfig } from "vite";
export default defineConfig({
build: { sourcemap: false }
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With