Skip to content

Instantly share code, notes, and snippets.

Using absolute paths and vite.

Static import

✔️ Posix style path

This is ok because the import is processed by vite or rollup and node never sees this.

import "C:/users/edivados/index.js";
function regReplaceWithComponent(
text: string,
exp: RegExp,
fn: (match: string, index: number) => JSXElement
) {
const matches = Array.from(text.matchAll(exp));
const items: JSXElement[] = [];
for (let index = 0; index < matches.length; index++) {
const match = matches[index];