question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding serverDependenciesToBundle causes build not to find other modules

See original GitHub issue

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”.

Error: Cannot find module 'async-lock'

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.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
kilimancommented, Jun 29, 2022

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"
2reactions
Songkeyscommented, Aug 18, 2022

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"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Module Constraints - Remix
Adding .server to the filename is a hint to the compiler to not worry about this module or its imports when bundling for...
Read more >
How to add dependencies to tests of another project in a multi ...
I have a multi-platform Kotlin project, which contains multiple modules (subprojects). The Building Multiplatform Projects withΒ ...
Read more >
Module::Build::Cookbook.txt - Perl Documentation
=head1 BASIC RECIPES =head2 Installing modules that use Module::Build In most ... in some other place, see L<"Adding new elements to the install...
Read more >
remix-run/remix v1.2.0 on GitHub - NewReleases.io
When you specify a build target, Remix will take care of configuring other details like the build directory and module format. serverBuildTarget supports...
Read more >
I can't seem to share test code between projects in a multi ...
In it there is a module that has tests that depend on test classes ... Could not get unknown property 'test' for SourceSet...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found