Nx: Module doesn't exist on jest config file for express application

Created on 13 Aug 2020  路  10Comments  路  Source: nrwl/nx

Current Behavior

I created an empty workspace and everything is working just fine but when I added an express application following the documentation on Express Plugin the jest.config.js file is giving me an error saying that module doesn't exist.

Expected Behavior

It shouldn't give me an error on the jest config file.

Steps to Reproduce

  1. npx create-nx-workspace@latest

Workspace name (e.g., org name): myorg
What to create in the new workspace: empty

  1. yarn add -D @nrwl/express
  2. nx generate @nrwl/express:application api

image

Environment

Windows 10, Node 12.18.3

linter bug

Most helpful comment

@zefexdeveloper seems like the eslintrc inside the api folder should use "ignorePatterns": ["/*.*", "!src/**/*"], so it will only lint whatever is inside your src folder. I will try to prepare a PR, but try it and tell me if that works for you 馃槂

All 10 comments

Thank you for submitting the issue.

The linter should only lint files in src.

@vsavkin What would be the solution for that?

@vsavkin Sorry for bothering but is there a solution for that yet? Thank you

@zefexdeveloper seems like the eslintrc inside the api folder should use "ignorePatterns": ["/*.*", "!src/**/*"], so it will only lint whatever is inside your src folder. I will try to prepare a PR, but try it and tell me if that works for you 馃槂

@bekos Thank you, I hope it gets merged 鉂わ笍

The linter should only lint files in src.

While it might happen that it should in reality it might be opposite. For instance, we're linting all config files per project. also when lib uses storybook ( config files are being linted within / not just configs - storybook helpers/components etc)

I'd say if you introduce this it's a breaking change ( for us it definitely will be)

I think this can be closed now. As of v10.3.0 there is a much more lightweight eslint builder and as a user you control what files are included for linting via the lintFilePatterns array within the builder options.

@JamesHenry I don't know how v10.3.0 would solve that, I just installed and it keep giving me the same error module is not defined. Is there something I can do like change some setting?

Ok fair enough, there is more of a config issue than a builder issue. We have some updates in the works which will more holistically address this automatically which should hopefully land in v10.4.0

@JamesHenry Thank you very much

Was this page helpful?
0 / 5 - 0 ratings

Related issues

about-code picture about-code  路  3Comments

joelmuskwe picture joelmuskwe  路  3Comments

danieldanielecki picture danieldanielecki  路  3Comments

jon301 picture jon301  路  3Comments

vimalraj-a picture vimalraj-a  路  3Comments