首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AOT编译中的警告和错误

AOT编译中的警告和错误
EN

Stack Overflow用户
提问于 2017-08-09 18:43:54
回答 1查看 472关注 0票数 1

我在AOT模式下有一些警告和错误,在JIT模式下没问题。

在AOT模式下,应用程序在浏览器中运行良好,但我在构建过程中收到警告和错误消息,如下所示:

例如,第一个警告:

代码语言:javascript
复制
WARNING in ./~/@swimlane/ngx-charts/release/ngx-charts.module.js
Cannot find source file '../build/ngx-charts.module.ts': Error: Can't resolve '../build/ngx-charts.module.ts' in '/Users/guest/Prive/DevAngular/proto-chartev3-angular/node_modules/@swimlane/ngx-charts/release'
 @ ./aot/src/app/app.module.ngfactory.ts 60:0-70
 @ ./src/main-aot.ts
 @ multi ./src/main-aot

例如,第一个错误:

代码语言:javascript
复制
ERROR in ./~/@swimlane/ngx-charts/release/common/base-chart.component.css
    Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example
        at Object.module.exports.pitch (/Users/guest/Prive/DevAngular/proto-chartev3-angular/node_modules/extract-text-webpack-plugin/loader.js:27:9)

ngx-charts版本:6.0.1

Angular版本: 4.2.4

Webpack版本: 2.2.1

我做错了什么?

EN

回答 1

Stack Overflow用户

发布于 2018-01-27 07:19:32

我猜是你的webpack配置出了问题。我已经解决了如下的提取-文本-webpack-插件错误:

代码语言:javascript
复制
// css loader for app styles
    {
      test: /\.css$/,
      exclude: /node_modules/,
      loader: ExtractTextPlugin.extract({
        fallback: 'style-loader',
        use: [
          { loader: 'css-loader', options: { minimize: true } },
        ],
      }),
    },
    // css loader for node_modules to prevent nasty warnings
    {
      test: /\.css$/,
      exclude: path.join(__dirname, 'src/frontend'),
      use: ['raw-loader', 'sass-loader'],
    },

要从node_modules中获取所有样式,您需要将它们导入styles.ts中的某个位置:

代码语言:javascript
复制
@import '~@swimlane/ngx-charts/release/index.css';
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45588447

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档