Comments (11)
I will definitely do this at some point. I took a stab at it earlier but couldn't figure out a great way to do it without having to host the binary somewhere myself, which I'd like to avoid if possible. My current plan is to figure out some way of having the install script invoke npm recursively to install the platform specific package. I'm not sure how straightforward that is. Please let me know if there are existing examples of packages that do this well.
from esbuild.
I was hoping that optional dependencies would work since they seem like the closest thing to what I want. However, they didn't end up working.
Optional dependencies sometimes randomly cause npm to install the binary in node_modules/esbuild/node_modules/esbuild-darwin-64
instead of node_modules/esbuild-darwin-64
. This means npx esbuild
no longer works because the binary lives in node_modules/esbuild/node_modules/.bin/esbuild
instead of node_modules/.bin/esbuild
. You can still do npm explore esbuild -- npx esbuild
to run it but I don't want to make people do that.
I'll have to figure something else out.
from esbuild.
Right i forgot npm had a way to publish prebuilt binaries. I know that https://github.com/Automattic/node-canvas does this to provide prebuilt binaries for the C++ code, it seems like they use a "binary" field in their package.json
from esbuild.
What do you mean by "unique npm package"? There is already binary npm packages available for esbuild if you mean that.
from esbuild.
I mean one package to be cross-platform, so I can install it in my project and I dont need worry about OS
from esbuild.
Binaries aren't cross-platform so not really, unless the owner makes a package that packages all binaries and use a script to execute one conditionally depending on the platform but it isn't really a good idea, makes package bigger and have to depend on a script to startup.
from esbuild.
@pollen5 I know that binaries are not cross-platform but what I suggested is to have a NPM package which identifies and install the right binary due the platform. I don't know if it is only possible with node-gyp.
from esbuild.
@pollen5 This binary
property is related to node-pre-gyp package
from esbuild.
Great idea, current format with different packages add a lot of pain to open source projects that want to use that library.
from esbuild.
You might publish a single package which lists every platform as an optional dependency. Npm/yarn will figure out which one to install based on the "os" field of the package.json. Example of that being used by the google-closure-compiler npm package:
https://github.com/google/closure-compiler-npm/blob/8a8c255015cf7bc46846449f3e706bc3c596f72d/packages/google-closure-compiler/package.json#L46
from esbuild.
Wouldn't it be possible to publish a package with the Go source files, and an install
/postinstall
script (that should be just make
)?
Yeah, the user should have Go and make already installed... but it's not that hard to install them, and I think that's kinda the same thing that node-fibers does π€
from esbuild.
Related Issues (20)
- idea: bundle embed or static file inside a single file. HOT 3
- Source maps containing `https://` urls get mangled
- Please give me tips how to solve router plain javascript app HOT 2
- How to get final version of build.initialOptions inside a plugin? HOT 2
- Basic question: where is the code that interacts with Nodejs workers? HOT 2
- How to add success log to watch ? HOT 2
- Bundling with HTML HOT 3
- How to build for adobe jsx? HOT 2
- CSS transforms can break nested selectors HOT 3
- Feature Request: Allow absolute paths for resolved chunks HOT 3
- Dynamic import issue when using react hook useEffect inside a remote component HOT 4
- Track which entryfile changed
- Glob pattern for `copy` file loader HOT 2
- Forcing node_modules resolution with the `resolve` function HOT 2
- punycode should be 'external' but bundled ? HOT 2
- Control module bundle dividers HOT 2
- [ERROR] Unexpected end of file in JSON ../jsconfig.json:18:0 - File does not exist in project and node_modules HOT 1
- `OnLoad` in custom plugin is called for disabled modules
- Specifying where compiled CSS files stored
- Assigning to the variable `name` doesnβt work when bundling to ESM output HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esbuild.