In vue/vite/rails stack sourcemap is completely off. Devtool showing incorrect line on error/debug. Can figure out what exactly causing issue.
vite.config.ts:
import {defineConfig} from "vite";
import rubyPlugin from "vite-plugin-ruby";
import vuePlugin from "@vitejs/plugin-vue";
import {nodePolyfills} from "vite-plugin-node-polyfills";
import * as requirePlugin from "vite-plugin-require";
import sassGlobImportPlugin from "vite-plugin-sass-glob-import";
export default defineConfig({
build: {
emptyOutDir: true,
sourcemap: true
},
resolve: {
alias: {
...
},
extensions: [".js", ".es6", ".ts", ".json", ".vue"]
},
plugins: [
rubyPlugin(),
nodePolyfills(),
vuePlugin({
template: {
compilerOptions: {
whitespace: "preserve"
}
}
}),
requirePlugin.default(),
sassGlobImportPlugin(),
],
clearScreen: false,
optimizeDeps: {
include: ["crypto"]
}
});
Example Component:
<template>
<div>
Home Page
</div>
</template>
<script>
export default {
name: "Home",
mounted() {
throw Error("This is error");
},
};
</script>
This is what it showing me in devtool:
Expect to show correct error line in devtool


vite-plugin-require