Skip to main content
Question

Sourcemap generation for bugsnag stack trace in a figma plugin react app.

  • February 4, 2025
  • 0 replies
  • 39 views

Abhinav1

I’ve build a figma plugin react app using vite. I’ve 2 config files I give something like this: 
vite.config.ui.js:

export default defineConfig({

plugins: [react(), viteSingleFile(), url()],

root: "src",

build: {

     outDir: "../dist",

     emptyOutDir: true,

     minify: false,

     sourcemap: true,

},

});

and 
vite.config.code.js:

export default defineConfig({
	plugins: [react(),
		viteSingleFile(),
		  url()],
	root: "src",
	build: {
		lib: {
			entry: "../code.tsx",
			fileName: "code",
			formats: ["es"],
		},
		minify: false,
		outDir: "../dist",
		sourcemap: true,
	},
});

In manifest.json I gave 
"ui": "./dist/index.html",
"main": "./dist/code.mjs"


The dist folder structure generated is something like this:
dist/assets/index-6f39be08.js.map
dist/code.mjs
dist/code.mjs.map
dist/index.html


I want to send the sourcemap to the bugsnag. I’m able to send the code.mjs.map but not the index-6f39be08.js.map since it looks for the corresponding js file as well. But all the js is inline in the index.html since Figma requires the plugin's code to be in one file.

My question is has anyone integrated bugsnag or any other analytical tool and record the stack trace with the source mapping? 

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings