Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted import error: 'EspLoader' is not exported from '@toit/esptool.js' #15

Open
plaffitt opened this issue Nov 8, 2022 · 3 comments

Comments

@plaffitt
Copy link

plaffitt commented Nov 8, 2022

Hello,

I'm trying to use your library in a React app but I'm facing a weird import issue at compile time only. When I run REACT_APP_API_URL=http://localhost:8000 react-app-rewired start it works, but when I run react-app-rewired build I got this error message :

> react-app-rewired build

Creating an optimized production build...
Failed to compile.

./src/serial/MicropythonSerialInterface.ts
Attempted import error: 'EspLoader' is not exported from '@toit/esptool.js'.

esptool.js version 0.12.3, typescript version 4.7.4, node version v16.18.0.

My import statement : import { EspLoader } from '@toit/esptool.js';

@floitsch
Copy link
Member

Sorry for the late response.

The original author of the library is not at the company anymore, and we are lacking the skill set to debug react related issues.
Sorry we can't do more at this time.

@leon0399
Copy link

I've made a fork with a fix and working on eventually supporting ESP32 C3 and S3 models: https://github.com/openhaptics/esptool.ts

@plaffitt
Copy link
Author

Hello,

I found a way to make it work. I just replaced the compilerOptions.module from CommonJS to esnext. I did it several month ago though, so I don't remember exactly why I came with this solution but it has been used in production for several month now and it works. I think the reason is that we use ES modules in our project and there are some incompatibilities between CommonJS and ESM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants