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

[Feature request] Resolve module dependency given the directory configuration in the package.json #22463

Closed
jgdev opened this issue Aug 22, 2018 · 2 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. feature request Issues that request new features to be added to Node.js. module Issues and PRs related to the module subsystem.

Comments

@jgdev
Copy link

jgdev commented Aug 22, 2018

The problem:

I have 2 projects in my application structure, I have a core library (@components) that is made in typescript and then compiled to plain-javascript in the build directory that exports an object CustomTable in the file build/CustomTable.js
In my another project that depends of the package @components, included using npm link, I had to specify the folder build when i’m trying to import the component CustomTable as following:

import CustomTable from '@myOrganization/components/build/CustomTable';

The possible solution:

Provide an option in the package.json that defines in what directory the module should be resolved, something like:

{
    "name": "@myOrganization/components",
    "version": "0.0.1",
    "resolveModuleFrom": "./build",
    "depedencies": {}
}

Then when I can use:

import CustomTable from '@myOrganization/components/CustomTable';

And the file CustomTable.js should be resolved in the build folder.

I also posted the feature request in the NPM community:
https://npm.community/t/provide-an-option-to-define-in-what-directory-the-module-will-be-resolved/1540

@jgdev jgdev changed the title Resolve module dependency given the directory configuration in the package.json [Feature request] Resolve module dependency given the directory configuration in the package.json Aug 22, 2018
@devsnek
Copy link
Member

devsnek commented Aug 22, 2018

why not just put your build in the root of your published package?

@devsnek devsnek added module Issues and PRs related to the module subsystem. feature request Issues that request new features to be added to Node.js. labels Aug 22, 2018
@mscdex
Copy link
Contributor

mscdex commented Aug 22, 2018

Duplicate of #21787

@mscdex mscdex marked this as a duplicate of #21787 Aug 22, 2018
@mscdex mscdex closed this as completed Aug 22, 2018
@mscdex mscdex added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. feature request Issues that request new features to be added to Node.js. module Issues and PRs related to the module subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants