Files
sweet/packages/plugin-vite/src/plugins/patches/jsx_comment.ts
T
Marvin Hagemeister afdf5eaf6c fix(vite): asset handling (#3225)
This PR reworks asset handling in our vite plugin. Importing assets in
js is now supported.
2025-08-19 16:45:33 +02:00

20 lines
484 B
TypeScript

import type { PluginObj, types } from "@babel/core";
export function jsxComments(): PluginObj {
return {
name: "fresh-jsx-comment",
visitor: {
Program(path) {
const comments = (path.parent as types.File).comments;
if (comments) {
for (let i = 0; i < comments.length; i++) {
const comment = comments[i];
comment.value = comment.value.replaceAll(/@jsx\w+\s+[^\s*]+/g, "");
}
}
},
},
};
}