by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Raziel
    @rraziel
    (since you don't import from apps)
    Eli Perelman
    @eliperelman
    let me clarify: in apps/server/src/index.ts i would like to alias import alpha from './models' to import alpha from '@/models' where @ maps to the project's src directory
    but if i set paths in the project's tsconfig, i cant import libraries using the root paths
    so if i can set it in the root tsconfig, then i think it would work
    Raziel
    @rraziel
    Hm that'd probably mess up webpack and everything anyway
    Why write @ instead of .?
    Eli Perelman
    @eliperelman
    i had it working prior to needing to import libraries :)
    i use tsconfig-paths to map to webpack
    Raziel
    @rraziel
    Yeah but you were the only one in the universe wanting to do that, might be a hint ;)
    Eli Perelman
    @eliperelman
    hehe, its actually quite common
    Raziel
    @rraziel
    Well I have yet to see a large project using it
    (or a small one really)
    eliperelman @eliperelman cracks knuckles. :D
    Raziel
    @rraziel
    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
    @eliperelman
    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
    Raziel
    @rraziel
    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
    @eliperelman
    the tough part is the double wildcard
    "@project/api-schema": ["libs/api-schema/src/index.ts"],
    "@/*": ["apps/*/src/*"]
    Raziel
    @rraziel
    I think it's just "*"
    But yeah not sure how you'd split the match
    Eli Perelman
    @eliperelman
    lol thats what i was afraid of
    Raziel
    @rraziel
    Although "@/*": "apps/*/src" could work I think
    Eh
    Nah nvm
    Eli Perelman
    @eliperelman
    i guess the other uglier option would be to copy paths from the root tsconfig to each project's tsconfig
    Raziel
    @rraziel
    Or use @app/xx instead of @/xx
    Eli Perelman
    @eliperelman
    right right
    Raziel
    @rraziel
    (or do like everyone else with relative paths :D)
    Eli Perelman
    @eliperelman
    lol
    Raziel
    @rraziel
    Doesn't nx have a lint error when you use the path alias in the module it refers to?
    Eli Perelman
    @eliperelman
    no, i use eslint and along with fork-ts-checker-webpack-plugin so they are all integrated and have knowledge of paths and aliases
    Raziel
    @rraziel
    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
    @eliperelman
    i have workspace lint set to only check files that arent part of a project's source
    Raziel
    @rraziel
    Oh well, back to work \o/
    Eli Perelman
    @eliperelman
    hehe, thank you so much for the help! i think copying into each project-specific tsconfig is the way ill go :)
    Tom McKearney
    @tommck
    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
    @KeKs0r

    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.

    Derek
    @derekkite
    @KeKs0r in the angular.json configuration file, in the specific app configuration section there is a filereplace setting.
    Marc Höffl
    @KeKs0r
    @derekkite I saw the filereplace setting, but does it work with .env files?
    Marc Höffl
    @KeKs0r
    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
    @KeKs0r
    --> I ended up doing it via a different script : env-cmd -f .production.env nx serve graph-api
    Raziel
    @rraziel
    Never understood the point of using those, I just have a config.json and a single build with empty environment.ts files
    Till
    @ruohki
    is it possible that the @nrwl/react package does not support decorators (setting the flags in the tsconfig dont help)
    Marc Höffl
    @KeKs0r

    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";
    
    run();
    function run() {
      _.map(['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
    @KeKs0r

    Maybe I should rephrase:

    how do you folks run arbitrary scripts in your projects?

    Manuel Bojato
    @KingDarBoja
    I have the same question