-
Notifications
You must be signed in to change notification settings - Fork 121
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
Add ESM support for @memlab/api (and remaining) #94
Comments
Thanks for bringing this issues to our attention. At the moment, To deal with the complications introduced by esbuild's bundling of However, we recognize the importance of a more robust and forward-looking solution. Before shifting to a more ESM-friendly method by leveraging the native JS import system for plugins, I need to come up with a better strategy for adaptable code synchronization without relying on |
Hey @JacksonGL Big thanks for the reply 🙇 Is there any specific values you mean the |
@doteric I was suggesting something like this as a short term solution. esbuild test.js --bundle --format=esm --define:__filename=\"./actual-filename.js\" --outfile=bundle.js I'm still trying to understand how you use MemLab in your project. If you have a GitHub repo that can replicate the problem that would be great. If that's too much work to create a demo, can you briefly explain how memlab is used in your project? E.g., do you import memlab's API in your node.js JS code and try to use esbuild to make a ESM bundle? |
@JacksonGL Anyway, I have solved both of the cases by using CJS and using a Lambda Layer with @memlab/* and the needed dependencies so that the files are not compiled with ESBuild and left intact which solves the issue. So the proposition would be to convert the package to fully support ESM, but it might take a bit of of fiddling to make it fully compatible so up to you if you would like to do it some day 😄 |
Hello,
I would like to request the addition of ESM (instead of just commonjs, preferably both should be supported) support.
Currently for example the
__filename
is used which is not supported inside ESM, additionally the exports require a full import and then destructing the object instead of only importing what's really needed.Is there any plan to introduce such support in the near future?
Thank you
➖ ➖ ➖ ➖
➕ Another problem that I have spotted
inside
TestRunnerLoader
After bundling with esbuild this breaks simply because esbuild builds into one file and looking up files inside a directory like that does not work and anyway in the ESM world such approach is not recommended. I would propose a different option of a list of available plugins and import them natively with js instead of using custom file loading. Generally anything using
__dirname
or similar should be replaced with aimport
of some sort 😃I would highly appreciate a fix for the above 🙇
The text was updated successfully, but these errors were encountered: