Skip to content

Commit

Permalink
chore: Rename templates to virtual-modules (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Jul 3, 2023
1 parent e14f81d commit 75eb3de
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand All @@ -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,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Types required to make templates happy.
// Types required to make the virtual modules happy.

declare module '*?raw' {
const content: any;
Expand Down
2 changes: 1 addition & 1 deletion src/core/vite-plugins/devHtmlPrerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/core/vite-plugins/virtualEntrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down

0 comments on commit 75eb3de

Please sign in to comment.