-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Adding serverDependenciesToBundle causes build not to find other modules #2930
Comments
Reverting back to v1.3.4 and there are no ESM warnings and the build works without |
I encountered a similar problem, and the downgrade to v1.3.4 as suggested here was the only fix that worked. While using v1.4.1, here's what I observed:
Reverting to v1.3.4 (without magic |
Hey @mcansh, I created a repo with a new Remix project to reproduce the issue that @sdalonzo reported. This commit shows how installing |
I have a script that will find all the ESM packages for you. https://github.com/kiliman/rmx-cli#-get-esm-packages ❯ rmx get-esm-packages @apollo/client
📦 @apollo/client
📦 ts-invariant
📦 zen-observable-ts
🔨 Add the following dependencies to your serverDependenciesToBundle
"@apollo/client",
"ts-invariant",
"zen-observable-ts" |
awesome @kiliman! our current |
I can't believe I need to include all the transitive dependencies! That's a huge list. Could we make this more smooth? (Below only shows the result of one of my deps.) ❯ npx rmx-cli get-esm-packages "@milkdown/core"
📦 @milkdown/core
📦 @milkdown/ctx
📦 @milkdown/exception
📦 @milkdown/transformer
📦 remark
📦 remark-parse
📦 mdast-util-from-markdown
📦 decode-named-character-reference
📦 character-entities
📦 mdast-util-to-string
📦 micromark
📦 micromark-core-commonmark
📦 micromark-factory-destination
📦 micromark-util-character
📦 micromark-util-symbol
📦 micromark-util-types
📦 micromark-factory-label
📦 micromark-factory-space
📦 micromark-factory-title
📦 micromark-factory-whitespace
📦 micromark-util-chunked
📦 micromark-util-classify-character
📦 micromark-util-html-tag-name
📦 micromark-util-normalize-identifier
📦 micromark-util-resolve-all
📦 micromark-util-subtokenize
📦 micromark-util-combine-extensions
📦 micromark-util-decode-numeric-character-reference
📦 micromark-util-encode
📦 micromark-util-sanitize-uri
📦 micromark-util-decode-string
📦 unist-util-stringify-position
📦 unified
📦 bail
📦 trough
📦 vfile
📦 vfile-message
📦 remark-stringify
📦 mdast-util-to-markdown
📦 longest-streak
📦 unist-util-visit
📦 unist-util-is
📦 unist-util-visit-parents
📦 zwitch
📦 @milkdown/design-system
🔨 Add the following dependencies to your serverDependenciesToBundle
"@milkdown/core",
"@milkdown/ctx",
"@milkdown/design-system",
"@milkdown/exception",
"@milkdown/transformer",
"bail",
"character-entities",
"decode-named-character-reference",
"longest-streak",
"mdast-util-from-markdown",
"mdast-util-to-markdown",
"mdast-util-to-string",
"micromark",
"micromark-core-commonmark",
"micromark-factory-destination",
"micromark-factory-label",
"micromark-factory-space",
"micromark-factory-title",
"micromark-factory-whitespace",
"micromark-util-character",
"micromark-util-chunked",
"micromark-util-classify-character",
"micromark-util-combine-extensions",
"micromark-util-decode-numeric-character-reference",
"micromark-util-decode-string",
"micromark-util-encode",
"micromark-util-html-tag-name",
"micromark-util-normalize-identifier",
"micromark-util-resolve-all",
"micromark-util-sanitize-uri",
"micromark-util-subtokenize",
"micromark-util-symbol",
"micromark-util-types",
"remark",
"remark-parse",
"remark-stringify",
"trough",
"unified",
"unist-util-is",
"unist-util-stringify-position",
"unist-util-visit",
"unist-util-visit-parents",
"vfile",
"vfile-message",
"zwitch" |
I'm running into this now. My serverless file was just kind of bundling the entire node_modules but apparently I did something that made that too big. I'm pretty sure the real bundle size is less than 5MB but hard to say since I can't get it to build properly. Currently I'm having to tediously build -> upload -> run app -> check error logs for missing dependency. The script has been useful for some libraries but there's quite a few outliers that it doesn't catch. Any potential updates or improvements coming to make this easier? |
ESM is the future, not the present. Until then, the workaround I’m using is to bundle the libraries I use in the Remix app, along with all the transitive dependencies, into a single-file CommonJS module (I use I hope Remix team fixes this issue soon. I spent many hours scratching my head over this and I was so close to migrating the app to Astro (which does not have any issue with ESM dependencies). |
I'm getting even though I'm using it in an action. Am I doing something wrong? |
Yes, plus |
What version of Remix are you using?
1.4.1
Steps to Reproduce
When a warning is shown that a package needs to be added to
serverDependenciesToBundle
, I add the package the config. But then the build fails on every other dependency with "Cannot find module".Removing the
serverDependenciesToBundle
from the config fixes the build but shows ESM warnings.I am installing dependencies with pnpm.
Expected Behavior
Adding
serverDependenciesToBundle
to config should remove ESM warnings and not break the build.Actual Behavior
Adding
serverDependenciesToBundle
to config does fix the ESM warnings, but causes build to fail.The text was updated successfully, but these errors were encountered: