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

Fix esbuild is actually not working, even if it is installed in a random nue project #255

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

fritx
Copy link
Collaborator

@fritx fritx commented Apr 7, 2024

This PR is based on PR #254 , and supposed to be merged after #254 is merged first.

Background:
I'm a Node user when I'm using my older MacOS. (Seems Bun is not supported in older MacOS, right?)
So I have to use Node + esbuild with nuekit.

The Bug:
Esbuild is actually not working, even if it is installed in a random nue-app.

Reason:
The chdir hack changes the actual cwd to nuekit srcdir, so getBundler is resolving esbuild from the the nuekit srcdir instead of the target nue-app dir.

Steps to reproduce:

# ensure nue srcdir is clean
# -- esbuild is not installed, as it is not declared in the dependencies
cd nuejs/nue
git checkout -- package.json pnpm-lock.yaml
rm package-lock.json yarn.lock
rm -rf node_modules

# linking to local nue srcdir
rm $(which nue) && (cd packages/nuekit && npm i && npm link) && which nue

# try to run nuekit
alias nu='node $(which nue)'
cd my_nue_app
npm i -D esbuild
rm -rf .dist && nu build && ls -la .dist/dev/@nue
# Actual Output
...
✓ Initialize .dist/dev: Bundler not found. Please use Bun or install esbuild
drwxr-xr-x  13 fritx  staff    416  4  7 16:36 .
drwxr-xr-x  11 fritx  staff    352  4  7 16:36 ..
-rw-r--r--   1 fritx  staff      0  4  7 16:36 .043
# Expected output
✓ Initialize .dist/dev: ••••••••••
...
drwxr-xr-x  13 fritx  staff    416  4  7 16:36 .
drwxr-xr-x  11 fritx  staff    352  4  7 16:36 ..
-rw-r--r--   1 fritx  staff      0  4  7 16:36 .043
-rw-r--r--  1 fritx  staff   1741  4  7 16:36 app-router.js
-rw-r--r--  1 fritx  staff  65144  4  7 16:36 diffdom.js
-rw-r--r--  1 fritx  staff   1199  4  7 16:36 error.css
-rw-r--r--  1 fritx  staff    966  4  7 16:36 error.js
-rw-r--r--  1 fritx  staff   2316  4  7 16:36 glow.css
-rw-r--r--  1 fritx  staff   2829  4  7 16:36 hotreload.js
-rw-r--r--  1 fritx  staff   1324  4  7 16:36 mount.js
-rw-r--r--  1 fritx  staff  10853  4  7 16:36 nue.js
-rw-r--r--  1 fritx  staff    660  4  7 16:36 nuemark.js
-rw-r--r--  1 fritx  staff   3346  4  7 16:36 page-router.js

@nobkd nobkd requested a review from tipiirai April 7, 2024 22:02
@tipiirai tipiirai merged commit 049d137 into nuejs:master Apr 8, 2024
3 checks passed
@tipiirai
Copy link
Contributor

tipiirai commented Apr 8, 2024

wow. great fix. thank you!

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

Successfully merging this pull request may close these issues.

2 participants