brillout / brillout/vite-plugin-mdx
add configure option to inferNamedImports
- Dominant language
- TypeScript
- Stars
- 121
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
### Clear and concise description of the problem
For monorepo projects, it is likely that both `react` and preact `packages` required in the dependencies, so passing `resolveImport('preact', root)` may be problematic
### Suggested solution
add configure option
### Alternative
yarn patch
```diff
diff --git a/dist/imports.js b/dist/imports.js
index 8f16352ab74f329dd01389d416059754bbf0a99f..418fc1b9b83b7111799c2fe4acd7564ba351df75 100644
--- a/dist/imports.js
+++ b/dist/imports.js
@@ -42,9 +42,7 @@ function assertImportExists(name, cwd) {
}
exports.assertImportExists = assertImportExists;
function inferNamedImports(root) {
- return resolveImport('preact', root)
- ? { preact: ['h'], '@mdx-js/preact': ['mdx'] }
- : { react: 'React', '@mdx-js/react': ['mdx'] };
+ return { react: 'React', '@mdx-js/react': ['mdx'] };
}
exports.inferNamedImports = inferNamedImports;
//# sourceMappingURL=imports.js.map
\ No newline at end of file
```
### Additional context
Sorry for any mistakes. English is not my native language
Contributor guide
No contributing guide indexed for this repository
Research direction
The payload points to dist/imports.js and inferNamedImports, with resolveImport('preact', root) controlling the current inference. Trace how inferNamedImports is called and how its configuration could be supplied; done means the preact-versus-React choice is configurable without relying on the monorepo dependency lookup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100