Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix vite build #1795

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/vite/src/hbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export function hbs(): Plugin {
return {
name: 'rollup-hbs-plugin',
enforce: 'pre',
async resolveId(source: string, importer: string | undefined) {
async resolveId(source: string, importer: string | undefined, options) {
if (options.custom?.embroider?.isExtensionSearch) {
return null;
}
let resolution = await this.resolve(source, importer, {
skipSelf: true,
});
Expand Down Expand Up @@ -89,6 +92,7 @@ async function maybeSynthesizeComponentJS(context: PluginContext, source: string
// Currently this guard is only actually exercised in rollup, not in
// vite, due to https://github.com/vitejs/vite/issues/13852
enableCustomResolver: false,
isExtensionSearch: true,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function resolver(): Plugin {
if (id.startsWith(virtualPrefix)) {
let { src, watches } = virtualContent(id.slice(virtualPrefix.length), resolverLoader.resolver);
virtualDeps.set(id, watches);
server.watcher.add(watches);
server?.watcher.add(watches);
return src;
}
},
Expand Down
6 changes: 5 additions & 1 deletion packages/vite/src/template-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export function templateTag({ inline_source_map } = { inline_source_map: false }
name: 'embroider-template-tag',
enforce: 'pre',

async resolveId(id: string, importer: string | undefined) {
async resolveId(id: string, importer: string | undefined, options) {
if (options.custom?.embroider?.isExtensionSearch) {
return null;
}
let resolution = await this.resolve(id, importer, {
skipSelf: true,
});
Expand All @@ -27,6 +30,7 @@ export function templateTag({ inline_source_map } = { inline_source_map: false }
skipSelf: true,
custom: {
embroider: {
isExtensionSearch: true,
enableCustomResolver: false,
},
},
Expand Down
Loading
Loading