Skip to content
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

Remix compiler always bundles tsconfig path aliases #7939

Open
1 task done
ilijaNL opened this issue Nov 8, 2023 · 0 comments
Open
1 task done

Remix compiler always bundles tsconfig path aliases #7939

ilijaNL opened this issue Nov 8, 2023 · 0 comments

Comments

@ilijaNL
Copy link

ilijaNL commented Nov 8, 2023

What version of Remix are you using?

2.2.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

  1. Create a monorepo without hoisting (default pnpm workspaces)
  2. Create a package @my-company/a
  3. Install some 3rd party dependencies to the @my-company/a package, say lodash and use it somewhere in code
  4. Create an remix app in monorepo and add the @my-company/a as a dependency ("@my-company/a": "workspace:*")
  5. Add path alias in tsconfig which targets the workspace package:
 "paths": {
      "~/*": ["./app/*"],
      // this somewhoe doesnt work
      "@my-company/a": ["../../packages/my-company/a/src"]
    },
  1. Try to run (dev) the remix app.
  2. Inspect the build/index.js: All the code from packages/my-company/a/src is bundled. This will result in importing dependencies of the @my-company/a package such as lodash which does not exist in node_modules of remix app

Expected Behavior

If the path aliasing matches a dependency, don't bundle the local package.
So in the end, the remix compiler should not bundle @my-company/a if @my-company/a is defined as a dependency in package.json of the app

Actual Behavior

The remix compiler bundles the monorepo package if path aliasing is used and doesn't respect the package.json dependencies.

related to #1405 and #2412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants