-
Notifications
You must be signed in to change notification settings - Fork 142
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
Outdated Optimize Dep
error when consuming 'normal' (direct) npm packages with vite – deps not ending up in node_modules/.vite/deps
#2168
Comments
can you try running the command |
if i run
nothing added/ no changes to If i run
|
right, thats what i am seeing as well |
oh, its used by sanitize-html. they do have some funny exports, but should work regardless. https://github.com/postcss/postcss/blob/main/package.json#L36 |
I've had to fix this with sanatize-html before too. Unfortunately this isn't an embroider problem, I imagine you would have the exact same issue if you used it in a vanilla vite package too I've fixed this in the past by patching postcss to add the extensions that it expects to be able to resolve that file: https://github.com/ember-learn/ember-api-docs/pull/920/files#diff-218116475a824ffaa3d495332d9bcf7dcd105c41f131ed71626cf1e7a66ac7d8 |
@mansona it works in a vanilla vite app. |
I think embroider needs to handle the browser field. Or somehow let vite deps plugin handle it. it is marked as excluded here: https://github.com/defunctzombie/package-browser-field-spec?tab=readme-ov-file#ignore-a-module |
+1 to the browser field. As is, loading content-tag in the browser is currently hinky requires patches/hacks). |
some parts are related to this code: it would also handle build-ins like |
I created a minimal reproduction of this bug in esbuild: evanw/esbuild#3976 The summary is, esbuild knows to consider certain paths "disabled" by the |
Steps to reproduce
sanitize-html
, or clone this repositiory for reproduction: https://github.com/johanrd/ember-vite-npmDetailed steps
1.1) create a new ember vite app with @NullVoxPopuli's great little ember-vite-blueprint
npx ember-cli@latest new glimmer-apollo-vite --blueprint @nullvoxpopuli/ember-vite-app --pnpm --typescript
1.2) pnpm install any npm library, e.g. 'pnpm install sanitize-html`
1.3) import the pnpm library into wherever, e.g. application.gts
1.4) run
pnpm start
Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep)
Npm packages most often do not end up in
node_modules/.vite/deps
. Possibly related to #1583.Is there a config I am missing? I have tried to add
include
in optimizeDeps(), but that stopped the vite server completely.The text was updated successfully, but these errors were encountered: