0xPolygonID / js-sdk

SDK to work with Polygon ID
https://0xpolygonid.github.io/js-sdk-tutorials/
Apache License 2.0
57 stars 33 forks source link

Can't import the named export 'O_TRUNC' (imported as 'O_TRUNC') from default-exporting module (only default export is available) #68

Closed grmkris closed 1 year ago

grmkris commented 1 year ago
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_TRUNC' (imported as 'O_TRUNC') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_CREAT' (imported as 'O_CREAT') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_RDWR' (imported as 'O_RDWR') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_TRUNC' (imported as 'O_TRUNC') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_CREAT' (imported as 'O_CREAT') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_RDWR' (imported as 'O_RDWR') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_EXCL' (imported as 'O_EXCL') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_RDONLY' (imported as 'O_RDONLY') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_CREAT' (imported as 'O_CREAT') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_RDWR' (imported as 'O_RDWR') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_CREAT' (imported as 'O_CREAT') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_RDWR' (imported as 'O_RDWR') from default-exporting module (only default export is available)
console.error @ client.js:1
client.js:1 ../node_modules/.pnpm/fastfile@0.0.20/node_modules/fastfile/src/fastfile.js
Can't import the named export 'O_EXCL' (imported as 'O_EXCL') from default-exporting module (only default export is available)
grmkris commented 1 year ago

found the problem... using pnpm patch i fixed it.. here is the whole patch content.. but not sure if useful for anyone

diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/1a87445a24d63ed7fdf7c4edf3113123.iml b/.idea/1a87445a24d63ed7fdf7c4edf3113123.iml
new file mode 100644
index 0000000000000000000000000000000000000000..24643cc37449b4bde54411a80b8ed61258225e34
--- /dev/null
+++ b/.idea/1a87445a24d63ed7fdf7c4edf3113123.iml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.tmp" />
+      <excludeFolder url="file://$MODULE_DIR$/temp" />
+      <excludeFolder url="file://$MODULE_DIR$/tmp" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000000000000000000000000000000000000..03d9549ea8e4ada36fb3ecbc30fef08175b7d728
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
+  </profile>
+</component>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8e27875f1e4f40cb1bb4dd772e4efe248be71c62
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/1a87445a24d63ed7fdf7c4edf3113123.iml" filepath="$PROJECT_DIR$/.idea/1a87445a24d63ed7fdf7c4edf3113123.iml" />
+    </modules>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/.idea/sonarlint/securityhotspotstore/index.pb b/.idea/sonarlint/securityhotspotstore/index.pb
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3cfeadc35eaeae8c2a991d5a2bd9a0175a1db9d1
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="RunManager">
+    <configuration default="true" type="OPA_TEST_RUN_CONFIGURATION" factoryName="Opa configuration factory">
+      <option name="additionalargs" value="" />
+      <envs />
+      <method v="2" />
+    </configuration>
+  </component>
+</project>
\ No newline at end of file
diff --git a/src/fastfile.js b/src/fastfile.js
index 25db11e36c0c255d40d9e0bd879d4b6c23ae7256..c0d9aa6d7c0f2dd97c2715da9b965558d2873898 100644
--- a/src/fastfile.js
+++ b/src/fastfile.js
@@ -2,7 +2,10 @@
 import { open } from "./osfile.js";
 import * as memFile from "./memfile.js";
 import * as bigMemFile from "./bigmemfile.js";
-import { O_TRUNC, O_CREAT, O_RDWR, O_EXCL, O_RDONLY } from "constants";
+import constants from 'constants';
+
+const { O_TRUNC, O_CREAT, O_RDWR, O_EXCL, O_RDONLY } = constants;
+

 const DEFAULT_CACHE_SIZE = (1 << 16);
 const DEFAULT_PAGE_SIZE = (1 << 13);

fixed:

image

broken:

image
grmkris commented 1 year ago

pnpm patch fastfile@0.0.20