Skip to content

Commit

Permalink
fix ?v= and ?t= urls in vite for hbs and gjs
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Nov 28, 2023
1 parent a1bb82f commit 745813d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/hbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function hbs(): Plugin {

switch (meta.type) {
case 'template':
let input = readFileSync(id, 'utf8');
let input = readFileSync(id.replace(/\.hbs\?.*/, '.hbs'), 'utf8');
let code = hbsToJS(input);
return {
code,
Expand Down Expand Up @@ -111,7 +111,7 @@ async function maybeSynthesizeComponentJS(context: PluginContext, source: string
};
}

const hbsFilter = createFilter('**/*.hbs');
const hbsFilter = createFilter('**/*.hbs?(\\?)*');

function maybeRewriteHBS(resolution: ResolvedId) {
if (!hbsFilter(resolution.id)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/template-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Plugin } from 'vite';
import { readFileSync } from 'fs';
import { Preprocessor } from 'content-tag';

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

export function templateTag(): Plugin {
let preprocessor = new Preprocessor();
Expand Down Expand Up @@ -44,7 +44,7 @@ export function templateTag(): Plugin {
if (!gjsFilter(id)) {
return null;
}
return preprocessor.process(readFileSync(id, 'utf8'), id);
return preprocessor.process(readFileSync(id.replace(/\.gjs\?.*/, '.gjs'), 'utf8'), id);
},
};
}

0 comments on commit 745813d

Please sign in to comment.