enderchief / esgleam Goto Github PK
View Code? Open in Web Editor NEW`esbuild` for Gleam (no NodeJS/Deno needed)
License: Apache License 2.0
`esbuild` for Gleam (no NodeJS/Deno needed)
License: Apache License 2.0
I'm getting this error here:
$ ./build/dev/bin/package/bin/esbuild ./build/dev/javascript/esme/gleam.main.mjs --bundle --outfile=./dist/esme.mjs --format=esm
✘ [ERROR] Could not resolve "node:net"
build/dev/javascript/node_socket_client/node_socket_client_ffi.mjs:1:23:
1 │ import { Socket } from "node:net";
╵ ~~~~~~~~~~
The package "node:net" wasn't found on the file system but is built into node. Are you trying to
bundle for node? You can use "--platform=node" to do that, which will remove this error.
1 error
How do I get around this?
Hello!
The module that contains the main function is bundled rather than actual entrypoint build/dev/javascript/$PACKAGE/gleam.main.mjs
, so if the bundled program is run no code is executed. I think the bundle ought to have the same behaviour and entrypoint as gleam run
.
Cheers,
Louis
When esgleam installs esbuild automatically, the JS implementation forces the use of the Erlang target.
In the context of a Gleam project that targets only JS this can be really confusing. I found out when my deployment CI failed after trying to execute escript
despite me explicitly not installing Erlang because I wasn't supposed to need it.
Esbuild installs fine when running gleam run -m esgleam/install
manually, which uses the JS target as prescribed by my project, so I'm not sure why the auto-install flow doesn't let that happen. I also tried removing --target=erlang
from the JS implementation and didn't spot any obvious issues after using the auto-install.
Hello! Thank you for this project, it rules!
It would be cool if it automatically installed the dep if has not been done yet, like how gleam run
does for Gleam deps.
Thanks,
Louis
The bundle and serve functionality is exposed to gleam code so you can run this stuff in a gleam program. I'd like to for that to be extended to the download/install functionality so I can call it from a wider CLI program.
One cool thing about TypeScript is the ability to use it without the build step on Deno or on nodejs (using esbuild-runner). It would be very cool to be able to use gleam in a similar fashion. Can esgleam be somehow integrated into esbuild-runner?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.