【发布时间】:2018-01-04 03:54:47
【问题描述】:
我有一个像这样的ts 文件
export const environment = {
production: false,
profile : './test/test.css'
};
我想导入 environment.profile 并设置它,以便我可以在 StyleUrls 中使用它
import { Component, OnInit } from '@angular/core';
import { TranslateService } from "@ngx-translate/core";
import {environment} from "../../environments/environment";
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: [environment.profile]
})
但我得到了错误:
错误:找不到模块“。” main.bundle.js:250:62 webpackMissingModule http://localhost:4200/main.bundle.js:250:62 ../../../../../src/app/header/header.component.ts http://localhost:4200/main.bundle.js:250:29 webpack_require http://localhost:4200/inline.bundle.js:55:12 ../../../../../src/app/app.module.ts http://localhost:4200/main.bundle.js:71:83 webpack_require http://localhost:4200/inline.bundle.js:55:12 ../../../../../src/main.ts http://localhost:4200/main.bundle.js:291:74 webpack_require http://localhost:4200/inline.bundle.js:55:12 [2] http://localhost:4200/main.bundle.js:309:18 webpack_require http://localhost:4200/inline.bundle.js:55:12webpackJsonpCallback http://localhost:4200/inline.bundle.js:26:23 http://localhost:4200/main.bundle.js:1:1 [WDS] 警告同时 编译。 vendor.bundle.js:13428:10 ./src/app/header/header.component.ts 32:17-45 关键依赖: 依赖项的请求是一个表达式 vendor.bundle.js:13493:4
我不知道怎么解决,谁能帮帮我
【问题讨论】:
标签: angular angular-cli