Fix first-party plugin usage when using bundled version of `tailwindcss` (#751)
parent
c0d593a9ae
commit
2e2dcc2e0e
|
@ -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(
|
||||
|
|
|
@ -910,9 +910,14 @@ async function createProjectService(
|
|||
let hook: Hook
|
||||
|
||||
if (loadConfig.module) {
|
||||
originalConfig = await loadConfig.module(state.configPath)
|
||||
originalConfig = originalConfig.default ?? originalConfig
|
||||
state.jit = true
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue