-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: resolve wxt modules from the root #1417
fix: resolve wxt modules from the root #1417
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
modulesDir: string, | ||
modules: string[] = [], | ||
): Promise<WxtModuleWithMetadata<any>[]> { | ||
const nodeRequire = createRequire(path.join(rootDir, 'index.js')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index.js
is not required to exist, but we cannot use a directory with createRequire
or else the directory itself won't be searched
@wxt-dev/auto-icons
@wxt-dev/module-react
@wxt-dev/i18n
@wxt-dev/module-solid
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/storage
@wxt-dev/unocss
wxt
commit: |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1417 +/- ##
==========================================
- Coverage 81.25% 80.98% -0.28%
==========================================
Files 128 128
Lines 6296 6284 -12
Branches 1070 1067 -3
==========================================
- Hits 5116 5089 -27
- Misses 1165 1180 +15
Partials 15 15 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, let's give it a go!
Overview
I have a local clone of WXT which I make fixes on and link into my web extension project for manual testing. My project is using a "WXT module" which is not being found by the current logic (before this PR). The reason is that WXT does a basic
import(…)
of each string in themodules
array, which doesn’t work when thewxt
package is symlinked into the project.I thought about using import-meta-resolve for a more comprehensive solution. For simplicity, I went with the same approach you took with
resolveWxtModuleDir
which is just usingcreateRequire
from thenode:module
API.Manual Testing
Related Issue