Snowpack with local npm packages

Viewed 943

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?

1 Answers

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"
    ]
}

Related