From 1719430498cc7dc5071b883cd301e6618ca41cbf Mon Sep 17 00:00:00 2001 From: Timofei Iatsenko Date: Fri, 24 Feb 2023 15:08:19 +0100 Subject: [PATCH] fix(vite): externalize macro imports (#1466) --- packages/vite-plugin/src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts index 3360e683e..295751b25 100644 --- a/packages/vite-plugin/src/index.ts +++ b/packages/vite-plugin/src/index.ts @@ -21,6 +21,12 @@ export function lingui(linguiConfig: LinguiConfigOpts = {}): Plugin { return { name: "vite-plugin-lingui", + config: (config) => { + // https://github.com/lingui/js-lingui/issues/1464 + config.optimizeDeps.exclude = config.optimizeDeps.exclude || [] + config.optimizeDeps.exclude.push("@lingui/macro") + }, + transform(src, id) { if (fileRegex.test(id)) { const catalogRelativePath = path.relative(config.rootDir, id)