Fix first-party plugin usage when using bundled version of `tailwindcss` (#751)

master
Brad Cornes 2023-03-30 10:30:52 +01:00 committed by GitHub
parent c0d593a9ae
commit 2e2dcc2e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -20,7 +20,7 @@ export default class Hook {
private _origRequire = Module.prototype.require
private _require: (req: string) => any
constructor(find: string, callback: (x) => {}) {
constructor(find: string, callback: (x) => {} = (x) => x) {
// @ts-ignore
if (typeof Module._resolveFilename !== 'function') {
throw new Error(

View File

@ -910,9 +910,14 @@ async function createProjectService(
let hook: Hook
if (loadConfig.module) {
hook = new Hook(fs.realpathSync(state.configPath))
try {
originalConfig = await loadConfig.module(state.configPath)
originalConfig = originalConfig.default ?? originalConfig
state.jit = true
} finally {
hook.unhook()
}
} else {
hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
originalConfig = klona(exports)