aurelia / aurelia

Aurelia 2, a standards-based, front-end framework designed for high-performing, ambitious applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vite load issue.

3cp opened this issue · comments

async load(id) {
if (!isVirtualTsFileFromHtml(id)) {
return null;
}
const htmlId = id.replace('.$au.ts', '.html');
const code = await promises.readFile(htmlId, { encoding: 'utf-8' });
const result = preprocess({
path: htmlId,
contents: code,
}, {
hmrModule: 'import.meta',
transformHtmlImportSpecifier: s => s.replace(/\.html$/, '.$au.ts')
});
return result!.code;
}
};

The preprocess in "load" func has missing options like the one in "transform" func.
I can fix it by adding missed back.

However I don't understand why we do preprocess in "load", as vite doc says "transform" is called immediately after "load". https://vitejs.dev/guide/api-plugin#universal-hooks

The "load" is definitely used by vitest.
Our normal vite+hmr is not affected by this issue.
It might affect vite build or vite wo hmr.

const htmlId = id.replace('.$au.ts', '.html');

Oh I saw the reason of load.