lazarv / react-server

The easiest way to build React apps with server-side rendering
https://react-server.dev
MIT License
121 stars 6 forks source link

fix: module resolution of third-party libraries #23

Closed lazarv closed 2 months ago

lazarv commented 2 months ago

This PR changes how module resolution works in @lazarv/react-server. This is a major change and needs more test cases in the future to maintain stability and quality.

Add support for the following third-party libraries:

Some packages need to be specifically marked as external to keep them usable.

Examples:

The external packages can be specified by adding a resolve.external section to react-server.config.json (.mjs or .ts) or vite.config.mjs (.ts).

{
  "resolve": {
    "external": ["better-sqlite3"]
  }
}

This PR should also fix the following issues:

To showcase usage of these third-party libraries, this PR also adds new examples:

Some low-level packages needed special attention:

github-actions[bot] commented 2 months ago

✅ Documentation preview deployed to: https://react-server-docs-a6yl56rwq-lazarv-team.vercel.app