-
Notifications
You must be signed in to change notification settings - Fork 90
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
passive watcher esm module #35
Comments
Hi @mdbetancourt. Thanks for feedback. Actually jiti preserves default + named exports but we cannot just imported them as named in stub mode. I guess we can improve this by emulating named exports using static analyze with mlly. (Generating named exports in stub) |
Also facing the same 😞 |
facing this issue Are they installed?
Failed to resolve import "file:///Users/username/Documents/tmp/test/node_modules/.pnpm/jiti@1.13.0/node_modules/jiti/lib/index.js" from "../dist/index.mjs". Does the file exist? Used antfu's starter |
same |
1 similar comment
same |
I think what I am seeing is this same issue, originally though it was a jiti problem, but moving details here. I am not sure stubs can currently be used with ESM as trying to use named exports doesn't work for stubs but using the default export doesn't work when built.
import { findPath } from "@nuxt/kit";
console.log(findPath);
you will see the error Then run |
some :/ |
I am also experiencing the issue, "Failed to resolve import" when using the stubbed project from a vite project, that depends on the stubbed project through a "link:..." dependency. It seems like vite is not able to resolve the file protocol import of jiti. Is there any new information on this, I am also using the ts-starter from antfu. Btw. the same issue also appears in larger projects like https://github.com/harlan-zw/unlighthouse for me, so maybe there is just a configuration problem on our end? |
also facing the same issue |
I'll just chime in here to point out that @pi0 has since implemented the following:
So, the jiti ESM stub does provide named exports now. For any of you experiencing related problems, it's worth first making sure you're on the latest version of unbuild first. Now, with that said, unfortunately, I think we will continue to run into issues with the stubs with different bundlers, etc. because we can't necessarily rely on the stub executing in the context of Node.js. You can see similar issues described here. I love the stub approach over a watch process (especially in monorepos) and have been relying on something similar from Preconstruct for a while now. Unfortunately, I'm just not sure it's possible to reproduce that functionality for ESM bundles when they are consumed by Next.js or Nuxt, etc. Preconstruct's CJS stub works with Next.js because it doesn't import any Node-specific packages ( |
I have to agree; this is an issue. We need the standard watch option here. I'm trying to replace |
Let's track active watcher via #281 |
unbuild uses
but this results in
which only do default export for esm modules (not named ones) i tried to figure it out how solve this but seems is not possible what you thing
The text was updated successfully, but these errors were encountered: