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

Feature request : watch mode ? #20

Closed
lewebsimple opened this issue Oct 31, 2021 · 8 comments
Closed

Feature request : watch mode ? #20

lewebsimple opened this issue Oct 31, 2021 · 8 comments

Comments

@lewebsimple
Copy link

Though it might be possible to use nodemon to achieve this, it would still be nice to have a watch mode built-in unbuild.

@pi0
Copy link
Member

pi0 commented Nov 2, 2021

Hi @lewebsimple. Instead, I would suggest you try passive watcher using unbuild stub :)

@lewebsimple
Copy link
Author

Thanks for the tip, I'm loving unbuild so much !!!

The problem with unbuild stub is that Nuxt3 can't find the plugin injected with addPluginTemplate in dev mode as it resolves the runtime in src/ and not dist/.

Should I add environment detection and conditionally set the runtime directory or is there a more transparent way ?

My project repository for reference: https://github.com/lewebsimple/nuxt3-graphql
(I'm putting together a suite of modules for GraphQL along with some example starters)

@flybayer
Copy link

It seems unbuild --stub is not compatible with nextjs builds, even when using next-transpile-modules

> web@0.0.0 build /Users/b/c/blitz2/apps/web
> next build

info  - Checking validity of types
info  - Creating an optimized production build
Failed to compile.

../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist/babel.js
Module not found: Can't resolve 'fs' in '/Users/b/c/blitz2/node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist'

Import trace for requested module:
../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/lib/index.js
../../packages/blitz/dist/index-browser.tsx.mjs
./pages/index.tsx

../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist/babel.js
Module not found: Can't resolve 'module' in '/Users/b/c/blitz2/node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist'

Import trace for requested module:
../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/lib/index.js
../../packages/blitz/dist/index-browser.tsx.mjs
./pages/index.tsx

../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist/babel.js
Module not found: Can't resolve 'v8' in '/Users/b/c/blitz2/node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist'

Import trace for requested module:
../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/lib/index.js
../../packages/blitz/dist/index-browser.tsx.mjs
./pages/index.tsx

../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist/jiti.js
Module not found: Can't resolve 'fs' in '/Users/b/c/blitz2/node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist'

Import trace for requested module:
../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/lib/index.js
../../packages/blitz/dist/index-browser.tsx.mjs
./pages/index.tsx

../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist/jiti.js
Module not found: Can't resolve 'module' in '/Users/b/c/blitz2/node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/dist'

Import trace for requested module:
../../node_modules/.pnpm/jiti@1.12.9/node_modules/jiti/lib/index.js
../../packages/blitz/dist/index-browser.tsx.mjs
./pages/index.tsx


> Build failed because of webpack errors
 ELIFECYCLE  Command failed with exit code 1.

@pi0
Copy link
Member

pi0 commented Jan 17, 2022

Hi @flybayer. This seems an issue with jiti. Do you have a reproduction I can check with?

@TorbjornHoltmon
Copy link

TorbjornHoltmon commented Feb 8, 2022

I am also really enjoying unbuild!
Unfortunately I am having similar issues when trying to consume stubbed packages with esbuild targeting browsers.
When targeting node, it resolves to the source files and can't resolve the exports.

And when trying to consume a stubbed package from nuxt 3 it can't find the package.

@productdevbook
Copy link

productdevbook commented Apr 21, 2022

some, custom write auth plugin vue and used unbuild but problem

image

@jrolfs
Copy link

jrolfs commented Feb 8, 2023

@flybayer I went pretty deep on this because I really love the stub approach in monorepos, but I'm not sure how feasible it would ever be to get working with client-side stuff. This comment has a summary of my findings, but I'd be happy to discuss further. Here's the Preconstruct hook that does work with Next.js, but it only works with CJS.

@pi0
Copy link
Member

pi0 commented Jul 18, 2023

Hi! Sorry for later response on this. I have made a new tracker issue to possibly support atice watchers: #281

@pi0 pi0 closed this as completed Jul 18, 2023
@pi0 pi0 mentioned this issue Jul 18, 2023
5 tasks
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

No branches or pull requests

6 participants