angular-cli - stylePreprocessorOptions 不适用于测试
问题描述
我对 stylePreprocessorOptions 的 includePath 有疑问,无论我做什么都不起作用。
我已经看到 github 上有已解决的票证,但我没有选择,任何想法都可能有所帮助:-)。我发现的任何来源都建议添加我已经添加的选项。
Error message:
ERROR in ./src/app/app.component.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
@import 'variables';
^
File to import not found or unreadable: variables.
in /home/rdeutz/projects/rbt/checkout-system-v3/src/app/app.component.scss (line 1, column 1)
Error:
@import 'variables';
这是我的配置:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my1": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist-my1",
"index": "src/index-my1.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"stylePreprocessorOptions": {
"includePaths": [
"src/my1"
]
},
....
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.scss",
"node_modules/font-awesome/css/font-awesome.css"
],
"assets": [
"src/assets",
"src/my1/favicon.ico"
],
"stylePreprocessorOptions": {
"includePaths": [
"src/my1"
]
}
}
},
一切都对构建有好处,但测试不起作用。
Versions:
Angular CLI: 7.2.3
Node: 10.15.0
OS: linux x64
Angular: 7.2.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.12.3
@angular-devkit/build-angular 0.12.3
@angular-devkit/build-optimizer 0.12.3
@angular-devkit/build-webpack 0.12.3
@angular-devkit/core 7.2.3
@angular-devkit/schematics 7.2.3
@angular/cli 7.2.3
@ngtools/webpack 7.2.3
@schematics/angular 7.2.3
@schematics/update 0.12.3
rxjs 6.3.3
typescript 3.2.4
webpack 4.28.4
npm --version -> 6.4.1
提前致谢!
解决方案
或多或少是一个愚蠢的错误。配置了两个项目,一个项目运行,另一个项目没有运行。所以错误来自第二次运行,第二次配置正确。
推荐阅读
- c++ - CMake 和 SOIL 链接
- python-3.x - Python3.6 Scapy 甚至从死主机接收 ICMP 响应
- python-2.7 - 是否可以在同一个类中访问另一个方法中的变量?
- javascript - 非标记返回时没有键的映射
- javascript - 正则表达式中的 Javascript 不匹配
- c++ - 字符串中的“for”循环迭代
- sql-server - SQL Server 2008 R2 安装卡住
- python - 使用 Bs4 从动态表中抓取行元素
- java - 后台工作人员的 Spring Boot 应用程序
- .net - Circuit-sdk - 如何通过 .net 进行交互?