File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -904,27 +904,35 @@ export async function extractPropControlsUnsafe(
904
904
const code = `import("${ fileUrl } ").then(x => { console.log("${ delimiter } "); console.log(${ propCode } ) })`
905
905
906
906
const TIMEOUT = 5 * 1000
907
- const UNFRAMER_MAP_PACKAGES = JSON . stringify ( {
907
+ const UNFRAMER_MAP_PACKAGES = {
908
908
unframer : url . pathToFileURL ( require . resolve ( '../esm/index.js' ) ) . href ,
909
909
react : url . pathToFileURL ( require . resolve ( 'react' ) ) . href ,
910
910
'react-dom' : url . pathToFileURL ( require . resolve ( 'react-dom' ) ) . href ,
911
911
'react/jsx-runtime' : url . pathToFileURL (
912
912
require . resolve ( 'react/jsx-runtime' ) ,
913
913
) . href ,
914
- } )
914
+ }
915
+ let loaderOption = `--loader ${ url . pathToFileURL (
916
+ require . resolve ( '../dist/unframer-loader.js' ) ,
917
+ ) } `
918
+ try {
919
+ require . resolve ( 'unframer/package.json' )
920
+
921
+ UNFRAMER_MAP_PACKAGES . unframer = ''
922
+ } catch { }
915
923
let stdout = await new Promise < string > ( ( res , rej ) => {
916
924
const cmd = `"${
917
925
nodePath
918
- } " --no-warnings --input-type=module --loader ${ url . pathToFileURL (
919
- require . resolve ( '../dist/unframer-loader.js' ) ,
920
- ) } -e ${ JSON . stringify ( code ) } `
926
+ } " --no-warnings --input-type=module ${ loaderOption } -e ${ JSON . stringify ( code ) } `
921
927
922
928
let childProcess = exec (
923
929
cmd ,
924
930
{
925
931
env : {
926
932
// ...process.env,
927
- UNFRAMER_MAP_PACKAGES ,
933
+ UNFRAMER_MAP_PACKAGES : JSON . stringify (
934
+ UNFRAMER_MAP_PACKAGES ,
935
+ ) ,
928
936
} ,
929
937
} ,
930
938
( err , stdout , stderr ) => {
You can’t perform that action at this time.
0 commit comments