mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Allow ./ in NetscriptJS import paths
This commit is contained in:
parent
43dc6f2309
commit
cb4203993d
@ -73,7 +73,7 @@ export function _getScriptUrls(script, scripts, seen) {
|
|||||||
// import {foo} from "blob://<uuid>"
|
// import {foo} from "blob://<uuid>"
|
||||||
//
|
//
|
||||||
// Where the blob URL contains the script content.
|
// Where the blob URL contains the script content.
|
||||||
let transformedCode = script.code.replace(/((?:from|import)\s+(?:'|"))([^'"]+)('|";)/g,
|
let transformedCode = script.code.replace(/((?:from|import)\s+(?:'|"))(?:\.\/)?([^'"]+)('|";)/g,
|
||||||
(unmodified, prefix, filename, suffix) => {
|
(unmodified, prefix, filename, suffix) => {
|
||||||
const isAllowedImport = scripts.some(s => s.filename == filename);
|
const isAllowedImport = scripts.some(s => s.filename == filename);
|
||||||
if (!isAllowedImport) return unmodified;
|
if (!isAllowedImport) return unmodified;
|
||||||
|
Loading…
Reference in New Issue
Block a user