wip
This commit is contained in:
parent
7e9db364c9
commit
3a7feb7930
2 changed files with 26 additions and 0 deletions
3
packages/@tailwindcss-cli/hook/esm.hook.mjs
Normal file
3
packages/@tailwindcss-cli/hook/esm.hook.mjs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { register } from 'node:module'
|
||||
|
||||
register(import.meta.resolve('./esm.loader.mjs'))
|
||||
23
packages/@tailwindcss-cli/hook/esm.loader.mjs
Normal file
23
packages/@tailwindcss-cli/hook/esm.loader.mjs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { isBuiltin } from 'node:module'
|
||||
|
||||
export async function resolve(specifier, context, nextResolve) {
|
||||
const result = await nextResolve(specifier, context)
|
||||
|
||||
if (result.url === import.meta.url) return result
|
||||
if (isBuiltin(result.url)) return result
|
||||
if (!context.parentURL) return result
|
||||
|
||||
let parent = new URL(context.parentURL)
|
||||
|
||||
let id = parent.searchParams.get('id')
|
||||
if (id === null) return result
|
||||
|
||||
let url = new URL(result.url)
|
||||
|
||||
url.searchParams.set('id', id)
|
||||
|
||||
return {
|
||||
...result,
|
||||
url: `${url}`,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue