S
S
shasoft2021-03-31 22:28:04
npm
shasoft, 2021-03-31 22:28:04

How to access the main project file in npm package?

There is a project. It has the AAA module in its NPM dependencies. Project A has a BBB module as a dependency.

Made a loader in the main project which is called like

import aaa from "!./src/my-loader!./AAA/package.json"

this loader should generate the code to call the view
import bbb from "!<что тут указать?>/my-loader!./BBB/package.json"

However, I can’t figure out how to make a link to this my loader in the generated code ? Since the file is in a dependent module, it is of type and does not know anything about the parent project.

Can anyone give me some advice or is this not possible at all?

pst.e. I understand that you can make your own module and write it in the dependencies in the AAA module, but I would like the link to go to the file in the main project.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question