-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
Bundling the CLI for reduced footprint failing in v4.x #603
Comments
We successfully bundle ink 4.x with |
Declaring |
There might be something wrong with your setup, all I can say is that for us it works - we bundle ink and {
entry: ['src/index.{ts,tsx}'],
target: 'node16.20',
format: 'esm',
outDir: 'build',
sourcemap: true,
minify: true,
shims: true,
// https://github.com/evanw/esbuild/issues/1921
banner: {
js: `
import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
`,
},
external: [
'react-devtools-core',
'yoga-wasm-web',
],
} |
I was able to make my build work by commenting out the devtools import after building: node_modules/.bin/esbuild src/index.js \
...
--external:react-devtools-core \
--external:yoga-wasm-web \
--define:process.env.NODE_ENV=\"production\"
sed -i '' 's#^import devtools#//import devtools#' dist/my-cmd.js Feels like a hack, but I'm happy that after a few hours of tinkering it finally works. I'll see what else breaks tomorrow 😄 |
I previously used
[email protected]
along with@vercel/ncc
to bundle all the deps of a cli, thus reducing the dependency graph within my users'node_modules
.I just upgrade ink to 4.x, and I do not find a way to bundle it without producing a non 0 exit code at runtime. It seems we're conflicting upon the top level await behaviour vs what the process is actually "waiting" for.
Here a bare example using ncc
I also tried: Rollup, a manual Webpack 5 config. They are all having issues in that direction.
Did anyone has this kind of issue already?
Generally speaking, how do you ship CLI in JS when they'll be installed locally in (mono)repos?
The text was updated successfully, but these errors were encountered: