Skip to content

Commit

Permalink
fix: use dynamic import to avoid vite warning (#16)
Browse files Browse the repository at this point in the history
* fix: use dynamic import to avoid vite warning

* chore: use dynamic import to avoid vite warning
  • Loading branch information
alexandrebodin authored Sep 12, 2024
1 parent e426fd5 commit 72e1e54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-bottles-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

---

fix: use dynamic import to avoid vite warning
5 changes: 3 additions & 2 deletions src/node/tasks/vite/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import react from '@vitejs/plugin-react-swc';
import { builtinModules } from 'node:module';
import path from 'path';
import { mergeConfig } from 'vite';

import { resolveConfigProperty } from '../../core/config';

Expand Down Expand Up @@ -134,7 +133,9 @@ const resolveViteConfig = async (ctx: BuildContext, task: ViteBaseTask) => {
plugins: [...basePlugins, ...plugins],
} satisfies InlineConfig;

return mergeConfig(config, ctx.config.unstable_viteConfig ?? {});
return import('vite').then(({ mergeConfig }) =>
mergeConfig(config, ctx.config.unstable_viteConfig ?? {})
);
};

export { resolveViteConfig };

0 comments on commit 72e1e54

Please sign in to comment.