2017-08-09 134 views
0

我在AOT模式下有一些警告和錯誤,在JIT模式下沒問題。AOT編譯中的警告和錯誤

在AOT模式的應用程序工作正常,在瀏覽器,但建築,像這樣在我有警告和錯誤消息:

例如第一個警告:

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 

例如第一個錯誤:

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-圖表版本:6.0.1

角版本:4.2.4

的WebPack版本:2.2.1

我到底做錯了什麼?

回答

0

我想這是你的webpack配置的問題。我已經解決了以下的提取物 - 文本的WebPack-插件錯誤:

// 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所有樣式:

@import '[email protected]/ngx-charts/release/index.css';