chore: Rename templates to virtual-modules (#24)
This commit is contained in:
+5
-5
@@ -11,7 +11,7 @@ const spinner = ora('Building WXT').start();
|
||||
|
||||
const startTime = Date.now();
|
||||
const outDir = 'dist';
|
||||
const clientTemplates = ['background', 'content-script'];
|
||||
const virtualEntrypoints = ['background', 'content-script'];
|
||||
|
||||
await fs.rm(outDir, { recursive: true, force: true });
|
||||
|
||||
@@ -38,20 +38,20 @@ await Promise.all([
|
||||
dts: true,
|
||||
silent: true,
|
||||
}),
|
||||
...clientTemplates.map((templateName) =>
|
||||
...virtualEntrypoints.map((entryName) =>
|
||||
tsup.build({
|
||||
entry: {
|
||||
[`templates/virtual-${templateName}`]: `src/client/templates/virtual-${templateName}.ts`,
|
||||
[`virtual-modules/${entryName}-entrypoint`]: `src/client/virtual-modules/${entryName}-entrypoint.ts`,
|
||||
},
|
||||
format: ['esm'],
|
||||
sourcemap: true,
|
||||
silent: true,
|
||||
external: [`virtual:user-${templateName}`],
|
||||
external: [`virtual:user-${entryName}`],
|
||||
}),
|
||||
),
|
||||
tsup.build({
|
||||
entry: {
|
||||
'templates/reload-html': `src/client/templates/reload-html.ts`,
|
||||
'virtual-modules/reload-html': `src/client/virtual-modules/reload-html.ts`,
|
||||
},
|
||||
format: ['esm'],
|
||||
sourcemap: true,
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Types required to make templates happy.
|
||||
// Types required to make the virtual modules happy.
|
||||
|
||||
declare module '*?raw' {
|
||||
const content: any;
|
||||
@@ -18,7 +18,7 @@ export function devHtmlPrerender(config: InternalConfig): vite.Plugin {
|
||||
alias: {
|
||||
'@wxt/reload-html': resolve(
|
||||
config.root,
|
||||
'node_modules/wxt/dist/templates/reload-html.js',
|
||||
'node_modules/wxt/dist/virtual-modules/reload-html.js',
|
||||
),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -31,7 +31,7 @@ export function virtualEntrypoin(
|
||||
const template = await fs.readFile(
|
||||
resolve(
|
||||
config.root,
|
||||
`node_modules/wxt/dist/templates/virtual-${type}.js`,
|
||||
`node_modules/wxt/dist/virtual-modules/${type}-entrypoint.js`,
|
||||
),
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user