fix: return absolute paths if one of the globs is absolute #7
Conversation
I'll add docs to the readme if we end up merging this. |
I updated the PR to remove the I don't see a use case for configuring this. Also, the user can always change the glob to fit what he wants: // If the user wants the file paths to be relative to root:
import.meta.importGlob('/path/to/*.js')
// Post-transform
{ "/path/to/some.js": () => import(/* ... */) }
// If the user wants the file paths to be relative to `__dirname`:
import.meta.importGlob('../../path/to/*.js')
// Post-transform
{ "../../path/to/some.js": () => import(/* ... */) } |
BTW, we have this vitejs/vite#6526 in Vite, which I haven't implemented in this plugin. Are you aware of it, and what do you think how it should affects this implementation? |
For multiple globs, do you think it makes sense for us to return the absolute paths if one of the globs is absolute? import.meta.importGlob(['/path/to/*.js', './*.ts')
// -->
{
"/path/to/some.js": () => import(/* ... */),
"/src/foo.ts": () => import(/* ... */)
} |
I'm not super happy about this, but I don't see an alternative. |
👍. I'd say: it's a nice-to-have we can implement later. I'd propose to get |
I will make a tweet later :) |
Exciting 😀. Btw, I'm going to release the new vps major |
Proposal for #6.