Nx. Publish library with deps

Nx monorepo, build library problem

ERROR: error TS6059: File '/libs/deps1/src/lib/xxx.ts' is not under 'rootDir' 'libs/need/src'. 'rootDir' is expected to contain all source files.

Add dist folder of dependency libs to main tsconfig.json

"paths": {
  "@project/core-api": [
    "dist/libs/core-api",  <==
    "libs/core-api/src/index.ts"
  ],
  "@project/validator-api": [
    "dist/libs/validator-api",  <==
    "libs/validator-api/src/index.ts"
  ],
  "@project/demo-api": ["libs/demo-api/src/index.ts"],
  "@project/settings": ["libs/settings/src/index.ts"],
  "@project/dynamic-form": ["libs/dynamic-form/src/index.ts"],
  },

Build need library

nx run need:build --with-deps
# or
nx run-many --target=build --projects=need --with-deps
# or
ng build core-api & ng build validator-api & ng build need

Publish

cd /dist/libs/need
npm publish 

Похожие записи

Добавить css link и js script динамически

const link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css';
link.integrity = 'sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO'; // необязательно
link.crossOrigin = 'anonymous'; // необязательно
document.head.appendChild(link);

const script = document.createElement('script');
script.src = 'https://code.jquery.com/jquery-3.3.1.slim.min.js';
script.integrity = 'sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo'; // необязательно
s...