Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Dec 22, 2023
1 parent 9692e8f commit 3b57f2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/vite/src/hbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { hbsToJS } from '@embroider/core';
import assertNever from 'assert-never';
import { parse as pathParse } from 'path';
import makeDebug from 'debug';
import { RollupModuleRequest } from './request';

const debug = makeDebug('embroider:hbs-plugin');

Expand All @@ -16,13 +15,14 @@ export function hbs(): Plugin {
name: 'rollup-hbs-plugin',
enforce: 'pre',
async resolveId(source: string, importer: string | undefined, options) {
let request = RollupModuleRequest.from(source, importer, options.custom);
if (!request) {
// fallthrough to other rollup plugins
if (options.custom?.onlyResolver) {
return null;
}
let resolution = await this.resolve(source, importer, {
skipSelf: true,
custom: {
onlyResolver: true
}
});

if (!resolution) {
Expand Down
9 changes: 5 additions & 4 deletions packages/vite/src/template-tag.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createFilter } from '@rollup/pluginutils';
import type { Plugin } from 'vite';
import { Preprocessor } from 'content-tag';
import { RollupModuleRequest } from './request';

const gjsFilter = createFilter('**/*.gjs?(\\?)*');

Expand All @@ -17,13 +16,14 @@ export function templateTag(): Plugin {
enforce: 'pre',

async resolveId(id: string, importer: string | undefined, options) {
let request = RollupModuleRequest.from(id, importer, options.custom);
if (!request) {
// fallthrough to other rollup plugins
if (options.custom?.onlyResolver) {
return null;
}
let resolution = await this.resolve(id, importer, {
skipSelf: true,
custom: {
onlyResolver: true,
},
});
if (resolution) {
return resolution;
Expand All @@ -32,6 +32,7 @@ export function templateTag(): Plugin {
resolution = await this.resolve(candidate, importer, {
skipSelf: true,
custom: {
onlyResolver: true,
embroider: {
enableCustomResolver: false,
},
Expand Down

0 comments on commit 3b57f2a

Please sign in to comment.