Make the ESM cache hook ESM-only
This commit is contained in:
parent
1b848f38b0
commit
85d6da4884
5 changed files with 7 additions and 9 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import '@tailwindcss/node/esm-cache-hook'
|
||||
|
||||
import watcher from '@parcel/watcher'
|
||||
import { getModuleDependencies } from '@tailwindcss/node'
|
||||
import { clearRequireCache } from '@tailwindcss/node/require-cache'
|
||||
|
|
@ -63,6 +61,8 @@ export function options() {
|
|||
}
|
||||
|
||||
export async function handle(args: Result<ReturnType<typeof options>>) {
|
||||
await import('@tailwindcss/node/esm-cache-hook')
|
||||
|
||||
let base = path.resolve(args['--cwd'])
|
||||
|
||||
// Resolve the output as an absolute path.
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
import { register } from 'node:module'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
|
||||
register(pathToFileURL(require.resolve('@tailwindcss/node/esm-cache-loader')))
|
||||
|
|
@ -17,6 +17,6 @@ export default defineConfig([
|
|||
format: ['cjs'],
|
||||
minify: true,
|
||||
dts: true,
|
||||
entry: ['src/esm-cache.hook.cts', 'src/require-cache.cts'],
|
||||
entry: ['src/require-cache.cts'],
|
||||
},
|
||||
])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { getModuleDependencies } from '@tailwindcss/node'
|
||||
import '@tailwindcss/node/esm-cache-hook'
|
||||
import { clearRequireCache } from '@tailwindcss/node/require-cache'
|
||||
import { Scanner } from '@tailwindcss/oxide'
|
||||
import fs from 'fs'
|
||||
|
|
@ -79,6 +78,8 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
|
|||
}
|
||||
},
|
||||
async OnceExit(root, { result }) {
|
||||
await import('@tailwindcss/node/esm-cache-hook')
|
||||
|
||||
let inputFile = result.opts.from ?? ''
|
||||
let context = cache.get(inputFile)
|
||||
let inputBasePath = path.dirname(path.resolve(inputFile))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { getModuleDependencies } from '@tailwindcss/node'
|
||||
import '@tailwindcss/node/esm-cache-hook'
|
||||
import { clearRequireCache } from '@tailwindcss/node/require-cache'
|
||||
|
||||
import { Scanner } from '@tailwindcss/oxide'
|
||||
|
|
@ -84,6 +83,8 @@ export default function tailwindcss(): Plugin[] {
|
|||
}
|
||||
|
||||
async function generateCss(css: string, inputPath: string, addWatchFile: (file: string) => void) {
|
||||
await import('@tailwindcss/node/esm-cache-hook')
|
||||
|
||||
let inputBasePath = path.dirname(path.resolve(inputPath))
|
||||
clearRequireCache(fullRebuildPaths)
|
||||
fullRebuildPaths = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue