-
I just noticed that source maps is turned off on my staging server (which in my case is meant to be identical to the production server). I think the Rails default of having sourcemaps in production is the right default, and I have not touched this setting. Pretty sure staging/production didn't make a difference in Webpacker, it had a fallback to production default if no environment was specified when building, if I remember correctly. But I don't rule out that my mind is playing tricks on me, I've been a happy vite_rails user for over a year now, so I might have forgotten about this. Configs: config/vite.json{
"all": {
"sourceCodeDir": "app/frontend",
"watchAdditionalPaths": []
},
"development": {
"autoBuild": true,
"publicOutputDir": "vite-dev",
"port": 3036
},
"test": {
"autoBuild": true,
"publicOutputDir": "vite-test"
}
} vite.config.js/* eslint import/no-extraneous-dependencies: off */
import { defineConfig } from "vite";
import eslint from "@rollup/plugin-eslint";
import RubyPlugin from "vite-plugin-ruby";
import StimulusHMR from "vite-plugin-stimulus-hmr";
import FullReload from "vite-plugin-full-reload";
import { brotliCompressSync } from "zlib";
import gzipPlugin from "rollup-plugin-gzip";
import { visualizer } from "rollup-plugin-visualizer";
export default defineConfig({
// Workaround for exports bug: https://github.com/vitejs/vite/issues/2579
optimizeDeps: { include: ["swiper"] },
// Use 2015 to transpile newer syntax
build: {
target: "es2015",
},
plugins: [
// Regular gzip
gzipPlugin(),
// Brotli compression
gzipPlugin({
customCompression: (content) => brotliCompressSync(Buffer.from(content)),
fileName: ".br",
}),
eslint({
include: "**/*.+(vue|js|jsx|ts|tsx)",
enforce: "pre",
}),
FullReload(["config/routes.rb", "app/views/**/*"]),
RubyPlugin(),
StimulusHMR(),
visualizer({
brotliSize: true,
template: "sunburst",
filename: "./public/bundle_stats.html",
}),
],
}); Firefox debugger panes: Is there an extra config line needed to make this work? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi! As discussed in the Configuration section, source maps are enabled by default in production, and since Which version of Looking at your |
Beta Was this translation helpful? Give feedback.
Hi!
As discussed in the Configuration section, source maps are enabled by default in production, and since
vite-plugin-ruby@3.0.9
in staging as well.Which version of
vite-plugin-ruby
are you using? Also, is yourstaging
environment building using theproduction
Rails env? Sourcemaps should be enabled even if your Rails environment was namedstaging
(not recommended by modern practices, but common back in the day).Looking at your
vite.config.ts
, I don't see any plugins which would explicitly disablesourcemaps
, but I'd recommend runningDEBUG="vite-plugin-ruby*" bin/vite build
and verify thatbuild.sourcemap
is set to true.