Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Also makes it less clear what's local and what's in a dependency
    So I guess it's to save on some ../.. and similar?
    Eli Perelman
    yeah, sets imports relative to the root source
    ill play around with the root paths and see if i can make it work and report back
    If you add "*" at the end of the list of paths, it doesn't work?
    (although it's not a list so the order shouldn't matter)
    Eli Perelman
    the tough part is the double wildcard
    "@project/api-schema": ["libs/api-schema/src/index.ts"],
    "@/*": ["apps/*/src/*"]
    I think it's just "*"
    But yeah not sure how you'd split the match
    Eli Perelman
    lol thats what i was afraid of
    Although "@/*": "apps/*/src" could work I think
    Nah nvm
    Eli Perelman
    i guess the other uglier option would be to copy paths from the root tsconfig to each project's tsconfig
    Or use @app/xx instead of @/xx
    Eli Perelman
    right right
    (or do like everyone else with relative paths :D)
    Eli Perelman
    Doesn't nx have a lint error when you use the path alias in the module it refers to?
    Eli Perelman
    no, i use eslint and along with fork-ts-checker-webpack-plugin so they are all integrated and have knowledge of paths and aliases
    I meant workspace-lint
    And the warning is because it knows about paths and aliases and says you shouldn't be doing it ;)
    Eli Perelman
    i have workspace lint set to only check files that arent part of a project's source
    Oh well, back to work \o/
    Eli Perelman
    hehe, thank you so much for the help! i think copying into each project-specific tsconfig is the way ill go :)
    Tom McKearney
    All, I'm trying to use NgUpgrade with my old AngularJS app in a lazy loaded library... Do I need to load angular itself at the beginning anyway so I can downgrade the root element to AngularJS for this to work?
    Marc Höffl

    Hi, I am new to gitter and just recently started using nx. I have migrated my app to it over the last 2 days (500+ files). Now I am trying to reproduce my previous dev environemnt.

    I was able to run my app locally in dev as well as in prod. prod is not only a production build, but when local it also connects into the production environment to debug with production data. This is achieved with a dedicated .env file. How do i tell the node builder to run the serve command with a specific envFile? I saw that workspace run-command does have this option, but noth sure how to provide it with the node builder.

    @KeKs0r in the angular.json configuration file, in the specific app configuration section there is a filereplace setting.
    Marc Höffl
    @derekkite I saw the filereplace setting, but does it work with .env files?
    Marc Höffl
    As well as the @nrwl/node:execute does not seem to take that argument. I can only pass a different buildTarget which I need to do to get the production build. But I dont want the production build, but rather just a dev build with different environment variables
    Marc Höffl
    --> I ended up doing it via a different script : env-cmd -f .production.env nx serve graph-api
    Never understood the point of using those, I just have a config.json and a single build with empty environment.ts files
    is it possible that the @nrwl/react package does not support decorators (setting the flags in the tsconfig dont help)
    Marc Höffl

    Does anyone have a good way of just executing a script file within a lib?
    lets say I have a ts file within a lib:

    import * as _ from "lodash";
    function run() {['a'], (a) => console.log(a))

    I am trying to execute it via ts-node

            "example": {
              "builder": "@nrwl/workspace:run-commands",
              "options": {
                "command": "yarn ts-node libs/admin/src/scripts/test-script.ts -s"

    But I am getting the following error:

    import * as _ from "lodash";
    SyntaxError: Cannot use import statement outside a module
    Marc Höffl

    Maybe I should rephrase:

    how do you folks run arbitrary scripts in your projects?

    Manuel Bojato
    I have the same question
    But now the second question still waiting for some insight, I read this cooment at but not sure how to use it and where should I put it
    I remember I asked something like that before Marc
    Luis Vargas
    Hello creating a new project with Angular 10 get next error:
     create-nx-workspace 9.5.1
    ? Workspace name (e.g., org name)     simple-chat
    ? What to create in the new workspace angular-nest      [a workspace with a full stack application (Angular + Nest)]
    ? Application name                    client
    ? Default stylesheet format           SASS(.scss)  [   ]
    ? Use the free tier of the distributed cache provided by Nx Cloud? No  [Only use local computation cache]
    Creating a sandbox with Nx...
    new simple-chat --preset="angular-nest" --appName="client" --style="scss" --interactive=false --collection=@nrwl/workspace
    CREATE simple-chat/nx.json (513 bytes)
    CREATE simple-chat/tsconfig.json (509 bytes)
    CREATE simple-chat/ (3407 bytes)
    CREATE simple-chat/.editorconfig (245 bytes)
    CREATE simple-chat/.gitignore (503 bytes)
    CREATE simple-chat/.prettierignore (74 bytes)
    CREATE simple-chat/.prettierrc (26 bytes)
    CREATE simple-chat/angular.json (96 bytes)
    CREATE simple-chat/package.json (1268 bytes)
    CREATE simple-chat/decorate-angular-cli.js (3093 bytes)
    CREATE simple-chat/tools/ (218 bytes)
    CREATE simple-chat/tools/schematics/.gitkeep (0 bytes)
    CREATE simple-chat/apps/.gitkeep (0 bytes)
    CREATE simple-chat/libs/.gitkeep (0 bytes)
    ✔ Packages installed successfully.
    /bin/sh: 1: ./node_modules/.bin/ng: not found
    Workspace creation failed, see above.
    (node:6568) UnhandledPromiseRejectionWarning: Error: Command failed: "/tmp/tmp-6568uTgi4X6nEAny/node_modules/.bin/ng" new simple-chat --preset="angular-nest" --appName="client" --style="scss" --interactive=false --collection=/tmp/tmp-6568uTgi4X6nEAny/node_modules/@nrwl/workspace/collection.json
        at checkExecSyncError (child_process.js:616:11)
        at Object.execSync (child_process.js:652:15)
        at createApp (/home/luis/.npm/_npx/6203/pnpm-global/4/node_modules/.pnpm/create-nx-workspace@9.5.1/node_modules/create-nx-workspace/bin/create-nx-workspace.js:366:21)
        at /home/luis/.npm/_npx/6203/pnpm-global/4/node_modules/.pnpm/create-nx-workspace@9.5.1/node_modules/create-nx-workspace/bin/create-nx-workspace.js:85:25
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:6568) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see (rejection id: 1)
    (node:6568) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    what am I doing wrong?
    Robin Van den Broeck
    Does anybody know how to inject global scss in a Storybook (using angular 9)
    hello, the proxy of react project doesn't work. anyone know why?
    Eran Sakal

    I'm using @nrwl/web:build to build react application. I'm not sure what was the change that I did but when building to production I'm stuck on

    Starting type checking service...
    Using 2 workers with 2048MB memory limit

    Since the log is emitted only after the build ends I don't know what is causing it to hang.

    1. building without production flag works
    2. adding --verbose flag is not propagated to the actual nx build
    3. trying --memoryLimit=4096 doesn't fix it

    Please help

    Eran Sakal

    Setting sourceMap: false and extractCss:false fixed it but obviously i need source maps. regarding extract css, maybe it will work regardless to its value but it doesn't bother me disabling it.

    how can I debug and fix source map issue?

    Mohi 🦀
    I got this error when i want to migrate from workspace@8.8.2 to latest.
    Invalid Version: 5.2
          else throw err
    Error: Command failed: ./node_modules/.bin/tao migrate @nrwl/workspace
    is it possible to lazy load a react lib application to an angular application ?
    if yes could you point me to example or different ways to achieve it ?
    Christopher Dieringer
    hey friends :wave: i have a buildable library for web. it's entirely custom, built with some shell scripts :facepalm:. when my next.js builder executes (the nrwl arch), i want my built artifacts from dist/ to be resolved, as it's buildable! however, i'm not seeing configuration options to say "hey, next builder--use built stuff vs lib/<my-lib>/src".