-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@nrwl/angular:package support for angular cli 13+ #7594
Comments
probably not a bug but it would be helpful to know when we can expect ng13 to work. |
Does that still happen with the latest 13 stable release? It was released a few hours after your post ^^ |
Yes, it's still happening on 13.0.0. |
we should wait for v 13.2 |
I have the same issue, any update ? |
This will be fixed when angular 13 support lands, in Nx 13.2. Support for Angular 13 is currently in progress, and is tracked by #7161. |
Still a problem for me in NX 13.2.0. Every single test in the application breaks with the same wordy message:
|
Did you update through |
Yes. I ran: It looped over nearly every dependency I have, and updated first the package.json, then installed the dependencies and finally ran a series of migrations, that updated the following files:
There were warnings when running migration-v13 for Angular Material and Angular CDK which stated that it could not find Typescript project for my library project and all of my e2e projects, but all other migrations were silent. This is my migrations.json:
|
What does your jest config look like for the project that is failing? |
Aha... I noticed that not all of my projects were updated with the migrations (unsure why). It managed to update all but my "defaultProject". I added the missing:
and got a little further.Now it fails on the following unique errors:
This was fixed by thymikee/jest-preset-angular#1147. I did have to modify the solution to make it work for me though. This is my fix (in jest.preset.js):
This actually dissapeared by itself after resolving the other two.
This was fixed by removing node_modules, doing this: angular/angular#35805 (comment), and then reinstalling. |
Running into the same issue. However, the jest.config.js files were all updated through the migration. Current jest.config.js:
Looks like it's missing the edit: Adding |
@Genesys-AlexW You need |
@AgentEnder thanks! |
I started NX just before version 13, upgraded to 13.2.2 now. I too have this issue:
package.json: "devDependencies": {
"@angular-devkit/build-angular": "^13.0.3",
"@angular-eslint/eslint-plugin": "13.0.1",
"@angular-eslint/eslint-plugin-template": "13.0.1",
"@angular-eslint/template-parser": "13.0.1",
"@angular/cli": "^13.0.3",
"@angular/compiler-cli": "^13.0.2",
"@angular/language-service": "^13.0.2",
"@nrwl/cli": "13.2.2",
"@nrwl/cypress": "13.2.2",
"@nrwl/eslint-plugin-nx": "13.2.2",
"@nrwl/jest": "13.2.2",
"@nrwl/linter": "13.2.2",
"@nrwl/tao": "13.2.2",
"@nrwl/workspace": "13.2.2",
"@nx-dotnet/core": "^1.6.0",
"@types/jest": "27.0.3",
"@types/node": "16.11.9",
"@typescript-eslint/eslint-plugin": "~5.4.0",
"@typescript-eslint/parser": "~5.4.0",
"eslint": "8.3.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-cypress": "^2.12.1",
"jest": "27.3.1",
"jest-preset-angular": "11.0.1",
"prettier": "^2.4.1",
"ts-jest": "27.0.7",
"typescript": "^4.4.4"
},
"dependencies": {
"@angular/animations": "^13.0.2",
"@angular/common": "^13.0.2",
"@angular/compiler": "^13.0.2",
"@angular/core": "^13.0.2",
"@angular/forms": "^13.0.2",
"@angular/platform-browser": "^13.0.2",
"@angular/platform-browser-dynamic": "^13.0.2",
"@angular/router": "^13.0.2",
"rxjs": "7.4",
"tslib": "^2.3.1",
"zone.js": "~0.11.4"
} jest.config.js: const { getJestProjects } = require('@nrwl/jest');
module.exports = {
projects: getJestProjects(),
preset: 'jest-preset-angular',
moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],
resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',
},
}; tried to look everywhere, nothing helped |
please reopen, as this is still an issue, even in 13.3.0-beta-2 |
Same issue here. Adding .mjs to transformIgnorePatterns and transform seems not to do anything. EDIT: Currently this code seems to work. But Jest has issues with all other modules imported.
The injectable 'PlatformLocation' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available. |
@EelcoLos What does the jest config look like for the individual projects? Its possible that transform is being overwritten in the projects jest config. Generally the transform is only set in the project config and not root (such that if you have angular and react packages as an example, jest-preset-angular is not affecting the react projects) |
@AgentEnder I tried using @Genesys-AlexW 's earlier comment, which didn't work at first (quoted it below). After some tweaking I got it working const { getJestProjects } = require('@nrwl/jest');
module.exports = {
projects: getJestProjects(),
preset: 'jest-preset-angular',
moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],
resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',
},
}; In the end I noticed the following lines being the change. I'm not sure which of these made it work, or a compound of all changes: transform: {
'^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',
}, Added mjs to transform target transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], the directory backslashes (and said location in the regex) are very important to find the mjs files Lastly, I used
|
Hi there |
@whisher that looks like a separate issue... |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
After updating to the latest angular 13 rc ( 13.0.0-rc.3 ) our libraries won't build via @nrwl/angular/src/executors/package/package.impl.js
Expected Behavior
libraries build
Steps to Reproduce
create a lib and the corresponding config in angular json
use angular 13.0.0-rc-3
"ngx-components": { "root": "libs/ngx-components", "sourceRoot": "libs/ngx-components/src", "projectType": "library", "prefix": "avn", "architect": { "build": { "builder": "@nrwl/angular:package", "options": { "tsConfig": "libs/ngx-components/tsconfig.dev.json", "project": "libs/ngx-components/ng-package.json", "buildableProjectDepsInPackageJsonType": "dependencies" }, "configurations": { "lpack": { "tsConfig": "libs/ngx-components/tsconfig.lib.json" }, "stylePreprocessorOptions": { "includePaths": ["libs/theming/src/scss"] } } },
other configurations have angularCompiler options set to use partial ivy build configuration.
Failure Logs
> nx run ngx-components:build:lpack Must use import to load ES Module: bla/node_modules/@angular/compiler-cli/bundles/index.js require() of ES modules is not supported. require() of bla/node_modules/@angular/compiler-cli/bundles/index.js from bla/node_modules/@nrwl/angular/src/executors/package/package.impl.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from bla/node_modules/@angular/compiler-cli/package.json.
Environment
Node : 14.17.0
OS : darwin x64
yarn : 1.22.4
nx : 13.1.2
@nrwl/angular : 13.1.2
@nrwl/cli : 13.1.2
@nrwl/cypress : 13.1.2
@nrwl/devkit : 13.1.2
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 13.1.2
@nrwl/linter : 13.1.2
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 13.1.2
@nrwl/web : Not Found
@nrwl/workspace : 13.1.2
@nrwl/storybook : 13.1.2
@nrwl/gatsby : Not Found
typescript : 4.4.4
The text was updated successfully, but these errors were encountered: