标签: angular-package-format

在 Cypress 测试中从 @angular/cdk 导入任何内容会破坏 Angular 13 的构建

自从更新到 Angular 13 以来,我从 @angular/cdk 导入的 Cypress 测试(主要是在 Angular 材料上使用测试工具)无法编译,并出现以下错误:

Error: Webpack Compilation Error
./node_modules/@angular/cdk/fesm2015/platform.mjs
Module not found: Error: Can't resolve '@angular/common' in 'C:\dev\workspace\exp\cypress-test\node_modules\@angular\cdk\fesm2015'
resolve '@angular/common' in 'C:\dev\workspace\exp\cypress-test\node_modules\@angular\cdk\fesm2015'
  Parsed request is a module
  using description file: C:\dev\workspace\exp\cypress-test\node_modules\@angular\cdk\package.json (relative path: ./fesm2015)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      C:\dev\workspace\exp\cypress-test\node_modules\@angular\cdk\fesm2015\node_modules doesn't exist or is not a directory
      C:\dev\workspace\exp\cypress-test\node_modules\@angular\node_modules doesn't exist or is not a directory
      C:\dev\workspace\exp\cypress-test\node_modules\node_modules doesn't exist or is not a directory
      C:\dev\workspace\exp\node_modules doesn't exist or is …
Run Code Online (Sandbox Code Playgroud)

angular cypress angular-package-format

5
推荐指数
1
解决办法
1194
查看次数

如何导入Angular 13库打包的SASS?

使用 Angular 13 以及ng-packagr当我们发布带有库的 SASS mixin 时,我们需要将该库添加到导出中package.json,并assetsng-package.json.

\n

这些是说明。

\n

https://github.com/ng-packagr/ng-packagr/blob/main/docs/copy-assets.md

\n

本期也对此进行了解释:\n SCSS @use 语句中的波浪号 ~ 自 Angular 13 起不再解析为 node_modules

\n

所以我已经为这个项目做到了这一点:\n https://github.com/fireflysemantics/big-packaged-component-example

\n

这是ng-package.json配置:

\n
{\n  "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",\n  "dest": "../../dist/big",\n  "assets": [\n    "./src/CHANGELOG.md",\n    "./src/lib/**/*.theme.scss"\n  ],\n  "lib": {\n    "entryFile": "src/public-api.ts"\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

这是package.json配置:

\n
\n   \n{\n  "name": "@fireflysemantics/big-packaged-component-example",\n  "version": "0.0.7",\n  "exports": {\n    ".": {\n      "sass": "./src/lib/big.component.theme.scss"\n    }\n  },\n  "peerDependencies": {\n    "@angular/common": "^13.3.0",\n    "@angular/core": "^13.3.0"\n  },\n  "dependencies": …
Run Code Online (Sandbox Code Playgroud)

sass npm angular ng-packagr angular-package-format

2
推荐指数
1
解决办法
4471
查看次数

Angular node_modules/@types 错误(服务构建问题)

之后NPM安装,当我尝试“纳克构建”出现以下错误:

ERROR in node_modules/@types/node/globals.d.ts(713,19): error TS2304: Cannot find name 'bigint'.
node_modules/@types/node/ts3.6/base.d.ts(13,21): error TS2727: Cannot find lib definition for 'esnext.bigint'. Did you mean 'esnext.intl'?
node_modules/@types/node/util.d.ts(119,56): error TS2304: Cannot find name 'BigInt64Array'.
node_modules/@types/node/util.d.ts(120,57): error TS2304: Cannot find name 'BigUint64Array'.
Run Code Online (Sandbox Code Playgroud)

angular angular7 angular-package-format

1
推荐指数
1
解决办法
2952
查看次数