4

We have problem to run snowpack with our package structure.

Our structure:

adapters
app
core
presentation

Each package contains typescript and all are used in the app package.

"dependencies": {
    "@project/adapters": "file:../../adapters",
    "@project/core": "file:../../core",
    "@project/presentation": "file:../../presentation",
}

I get the error Dependency Install Error: Package "@project/adapters/src/repositories/GradeFeedRepositoryImpl" not found. Have you installed it?

How do I need to configure snowpack, web pack, babel, ... to run this?

Ben Keil
  • 1,050
  • 1
  • 10
  • 30

1 Answers1

0

I have had success with packing modules (using: npm pack /path/to/module from the root of the module's folder) and adding the tarball to my package.json from a folder within the repo. e.g.,

"dependencies": {
...

   "adapters": "file:packs/adapters-1.0.0.tgz"

...
}


Another option, see if making this edit to your snowpack.config.js file helps:

packageOptions: {
    external: [
        "@projects/adapters"
    ]
}

Harley Lang
  • 2,063
  • 2
  • 10
  • 26
  • Could you just build the module and use it with link protocol in the main package.json? – Ben Keil Jun 17 '21 at 00:21
  • I think that will depend on how you deploy your application. For example for one of my repos, I copy and build the app in a dockerfile. With a relative link, the module will be missing (as it lives in its own repo), so I don't believe relative links will work in all deployment environments. – Harley Lang Jun 22 '21 at 21:30