【发布时间】:2017-11-24 00:58:51
【问题描述】:
我正在尝试将 MDC 用于 Web。首先,我首先设置主题。 跟着这个。
npm install -g @angular/cling new --style scss test-projectcd test-projectnpm i material-components-web --savenpm i-
打开
styles.scss并添加以下内容$mdc-theme-primary: #002D72; $mdc-theme-accent: #f98710; $mdc-theme-background: #fff; @import "../node_modules/material-components-web/material-components-web"; //@import "~material-components-web/material-components-web";
这给出了错误:
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/sass-loader!./src/styles.scss
Module build failed:
@import "@material/animation/mdc-animation";
^
File to import not found or unreadable: @material/animation/mdc-animation.
我知道我在 MDC for Web 中直接设置了所有路径(不是相对路径),因此我收到此错误。 他们有这样的进口:
@import "@material/animation/mdc-animation";
为了我们工作,应该是
@import "~@material/animation/mdc-animation";
需要帮助如何解决此问题。可能我需要弹出 angular-cli 并配置它的 webpack 配置。
【问题讨论】:
标签: angular webpack sass angular-cli