Closed hhvrc closed 8 months ago
I've made a fix in #127. Could you test the artifact to see if it works ?
The changes made in #127 does not solve my issue.
I am currently using patch-package to fix esptool-js being broken locally.
This is the patch that makes esptool-js 0.4.1 work for me:
diff --git a/node_modules/esptool-js/lib/esploader.js b/node_modules/esptool-js/lib/esploader.js
index 6e80537..09df456 100644
--- a/node_modules/esptool-js/lib/esploader.js
+++ b/node_modules/esptool-js/lib/esploader.js
@@ -1,8 +1,8 @@
-import { ESPError } from "./error";
+import { ESPError } from "./error.js";
import { deflate, Inflate } from "pako";
-import { Transport } from "./webserial";
-import { customReset, usbJTAGSerialReset } from "./reset";
-import { Buffer } from "buffer/index";
+import { Transport } from "./webserial.js";
+import { customReset, usbJTAGSerialReset } from "./reset.js";
+import { Buffer } from "buffer/index.js";
/**
* Return the chip ROM based on the given magic number
* @param {number} magic - magic hex number to select ROM.
diff --git a/node_modules/esptool-js/lib/index.js b/node_modules/esptool-js/lib/index.js
index e999db9..14d574f 100644
--- a/node_modules/esptool-js/lib/index.js
+++ b/node_modules/esptool-js/lib/index.js
@@ -1,4 +1,4 @@
-export { ESPLoader } from "./esploader";
-export { classicReset, customReset, hardReset, usbJTAGSerialReset, validateCustomResetStringSequence } from "./reset";
-export { ROM } from "./targets/rom";
-export { Transport } from "./webserial";
+export { ESPLoader } from "./esploader.js";
+export { classicReset, customReset, hardReset, usbJTAGSerialReset, validateCustomResetStringSequence } from "./reset.js";
+export { ROM } from "./targets/rom.js";
+export { Transport } from "./webserial.js";
@brianignacio5 #127 does not fix this issue, can you re-open this?
Thanks
Due to the way its defined this makes the library unusable with esbuild projects like Vite, SvelkteKit as a npm module.
Steps to reproduce:
1. Install project (with typescript support)
2. Create example usage in any file
3. Import this into +page.svelte and use it
4. Build project
Error output: