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

handle node_modules paths, and use module name instead of relative path #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

industral
Copy link

Assume we have

import myModule from 'awesomeModule';

and in tsconfig-esm.json

    "baseUrl": ".",
    "paths": {
      "awesomeModule": ["./node_modules/awesomeModule/dist/esm/index.js"]
    }

and in tsconfig-cjs.json

    "baseUrl": ".",
    "paths": {
      "awesomeModule": ["./node_modules/awesomeModule/dist/cjs/index.js"]
    }

In that case, it should resolve as awesomeModule/dist/cjs/index.js and awesomeModule/dist/esm/index.js respectively. But currently, it resolved as relative paths, and fails, as import statement made from source code, and now it's in dist folder, which make relative paths broken, e.g. Error: Cannot find module <PATH>/dist/node_modules/awesomeModule/dist/esm/index.js.

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

Successfully merging this pull request may close these issues.

1 participant