From 84cf45772ed59f5eae747c15fbffc375768007b8 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:37:14 +0530 Subject: [PATCH] fix(build): allow data-loaders files in packages to be found (closes #2272) Co-authored-by: John Campion Jr --- src/node/plugins/staticDataPlugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/plugins/staticDataPlugin.ts b/src/node/plugins/staticDataPlugin.ts index 4c977603..b5e0f3c0 100644 --- a/src/node/plugins/staticDataPlugin.ts +++ b/src/node/plugins/staticDataPlugin.ts @@ -8,7 +8,7 @@ import path, { dirname, resolve } from 'path' import { isMatch } from 'micromatch' import glob from 'fast-glob' -const loaderMatch = /\.data\.(j|t)s$/ +const loaderMatch = /\.data\.(j|t)s($|\?)/ let server: ViteDevServer @@ -71,7 +71,7 @@ export const staticDataPlugin: Plugin = { } else { // use vite's load config util as a away to load Node.js file with // TS & native ESM support - const res = await loadConfigFromFile({} as any, id) + const res = await loadConfigFromFile({} as any, id.replace(/\?.*$/, '')) // record deps for hmr if (server && res) {