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 _origRequire = Module.prototype.require
|
||||||
private _require: (req: string) => any
|
private _require: (req: string) => any
|
||||||
|
|
||||||
constructor(find: string, callback: (x) => {}) {
|
constructor(find: string, callback: (x) => {} = (x) => x) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (typeof Module._resolveFilename !== 'function') {
|
if (typeof Module._resolveFilename !== 'function') {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
@ -910,9 +910,14 @@ async function createProjectService(
|
||||||
let hook: Hook
|
let hook: Hook
|
||||||
|
|
||||||
if (loadConfig.module) {
|
if (loadConfig.module) {
|
||||||
|
hook = new Hook(fs.realpathSync(state.configPath))
|
||||||
|
try {
|
||||||
originalConfig = await loadConfig.module(state.configPath)
|
originalConfig = await loadConfig.module(state.configPath)
|
||||||
originalConfig = originalConfig.default ?? originalConfig
|
originalConfig = originalConfig.default ?? originalConfig
|
||||||
state.jit = true
|
state.jit = true
|
||||||
|
} finally {
|
||||||
|
hook.unhook()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
|
hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
|
||||||
originalConfig = klona(exports)
|
originalConfig = klona(exports)
|
||||||
|
|
Loading…
Reference in New Issue