custom module: fix nativeRequire resolve path (somehow broke during esm migration)
This commit is contained in:
parent
b8c59db5f3
commit
0bfbf59f0f
2 changed files with 5 additions and 5 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- bug fixes
|
||||
- regression breaking user asset loading from a root directory named "assets"
|
||||
- regression breaking custom module's `nativeRequire()` for locally installed modules
|
||||
|
||||
## 1.30.0
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import fs from 'fs'
|
|||
import vm from 'vm'
|
||||
import chokidar from 'chokidar'
|
||||
import path from 'path'
|
||||
import {globalPaths} from 'module'
|
||||
import {Module} from 'module'
|
||||
import * as settings from './settings.mjs'
|
||||
|
||||
var modulePathExtended = false,
|
||||
|
|
@ -79,10 +79,9 @@ class CustomModule {
|
|||
}
|
||||
|
||||
if (!this.submodule && !modulePathExtended) {
|
||||
globalPaths.push(
|
||||
path.resolve(path.dirname(this.filename)),
|
||||
path.resolve(path.dirname(this.filename), 'node_modules')
|
||||
)
|
||||
process.env.NODE_PATH += path.delimiter + path.resolve(path.dirname(this.filename))
|
||||
process.env.NODE_PATH += path.delimiter + path.resolve(path.dirname(this.filename), 'node_modules')
|
||||
Module._initPaths()
|
||||
modulePathExtended = true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue