Publishing shared node module class to production

Viewed 24

This is my first real project using node.js, so please excuse my ignorance.

I have a project structure that looks like this.

+-- server // node js (express) server
|   +-- src
|       +-- // src files here
|   +-- package.json
|   +-- tsconfig.json
+-- client // client (react)
|   +-- src
|       +-- // src files here
|   +-- package.json
|   +-- tsconfig.json
+-- shared // shared modules (models, view models, etc)
|   +-- models
|       +-- // models here
|   +-- package.json
|   +-- tsconfig.json
+-- package.json // (for npm-run-all mostly)

Right now the shared project is linked through npm link. The models are imported using import <model name> from "@local/shared/models" (I'm using TypeScript as well). I'm wondering how I can publish the shared project without adding if statements for my import statements. Would I have to put the shared build directly into the node_modules server build? I'd appreciate any suggestions/guidance!

0 Answers
Related