I m rebuilding an old documentation website with astro, and so far i m here: https://fabricjs.github.io/
I want to have examples in the pages that are created by the code that run the example itself, and so far i have skipped any interactive editor plugins because i m trying to move as fast as possible.
This is in brief what i do:
https://github.com/fabricjs/fabricjs.github.io/blob/main/src/content/docs/docs/old-docs/clippath-part1.jsx
I create the simple example, and then i have a utility that wrap the example code and return a component.
The component takes the function, makes a toString, and on top of running it, it will display it. That's it.
In development is all good and looks like in the nicer attached picture.
In production i already disabled minification by doing:
export default defineConfig({
integrations: [...],
vite: {
build: {
minify: false,
}
},
});
But it is still mangling imports and names ( see the image with short names ).
What bother me most is that if it would just minify the import as i wrote them:
var clipPath = new fabric.Circle({ radius: 100, top: -100, left: -100 });
would become
var clipPath = new ml.Circle({ radius: 100, top: -100, left: -100 });
And that would be fine.
But instead we are getting:
var clipPath = new Ln({ radius: 100, top: -100, left: -100 });
That makes a tad too much to move forward.
I understand is not a minification issue but more an import/export rewrapping and optimization that i would like to disable or even just force to not happen with some tweak in the code.
link to one of the affected pages:
https://fabricjs.github.io/docs/old-docs/clippath-part2/
Help appreciated.
Thanks