Is it possible to enable sourcemaps in Vue-Vite in production environment?
I would like to use it for Bugsnag.
Can't find anything about it in the docs.
Is it possible to enable sourcemaps in Vue-Vite in production environment?
I would like to use it for Bugsnag.
Can't find anything about it in the docs.
Vite 2.x (docs):
// vite.config.js
export default {
build: {
sourcemap: true,
},
}
Vite 1.x:
// vite.config.js
export default {
sourcemap: true,
}
I'm using Vite 2.9 and a CSS sourcemap was not being loaded by the browser. (I'm also using Typescript, in case that is relevant to you.)
Based on the @types for vite.config.ts, there is a devSourcemap property under css which you can set to true.
Here is the vite.config.ts file I'm currently using:
import ...;
...
export default defineConfig({
plugins: [
vue(),
checker({
typescript: true,
vueTsc: true,
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
css: {
devSourcemap: true,
},
});
This link will help you.
https://vitejs.dev/config/build-options.html#build-sourcemap
This is a simple example for use:
// vite.config.js
export default {
build: {
sourcemap: true,
},
}