简体   繁体   English

AnimationRendererFactory AOT:无法读取未定义的属性“ createRenderer”

[英]AnimationRendererFactory AOT: Cannot read property 'createRenderer' of undefined

I am trying to compile my angular4 app AOT and am stuck on the error: 我正在尝试编译我的angular4应用AOT并卡在错误中:

TypeError: Cannot read property 'createRenderer' of undefined
at AnimationRendererFactory.createRenderer (http://localhost:8080/cwp/static/app.bundle.undefined.js:114555:54)
at DebugRendererFactory2.createRenderer (http://localhost:8080/cwp/static/app.bundle.undefined.js:13319:49)
at createRootData (http://localhost:8080/cwp/static/app.bundle.undefined.js:12759:53)

Here are my relevant configs: 这是我的相关配置:

tsconfig tsconfig

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "noEmit": true,
    "noEmitHelpers": true,
    "importHelpers": true,
    "strictNullChecks": false,
    "lib": [
      "es2015",
      "dom"
    ],
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true
  },
  "include": [
    "app/app.module.ts",
    "app/**/*.ts",
    "app/main.aot.ts"
  ],
  "exclude": [
    "node_modules",
    "dist",
    "**/*.spec.ts",
    "**/*.e2e.ts",
    "test",
    "app/main.ts"
  ],
  "angularCompilerOptions": {
    "genDir": "compiled",
    "skipMetadataEmit": true
  }
}

webpack.config webpack.config

var webpack = require('webpack');
const helpers = require('./helpers');

var version = '.' + process.env.version;

module.exports = function MakeConfig() {
    var config = {};

    config.entry = {
        'polyfills': './polyfills.ts',
        'app': ['./app/main.aot.ts' ]
    };

    config.output = {
        path: helpers.root('dist'),
        filename: "./[name].bundle" + version + ".js",
        chunkFilename: "./[id].chunk" + version + ".js",
        publicPath: '/cwp/static/'
    };

    config.module = {
        rules: [
            {
                test: /\.ts$/,
                use: [
                    {
                        loader: 'awesome-typescript-loader'
                    },
                    {
                        loader: 'angular2-template-loader'
                    },
                    {
                        loader: 'angular-router-loader?aot=true&genDir=compiled'
                    }
                ],
                exclude: [/\.(spec|e2e)\.ts$/]
            },

            /* Raw loader support for *.html
             * Returns file content as string
             *
             * See: https://github.com/webpack/raw-loader
             */
            {
                test: /\.(css|html)$/,
                use: 'raw-loader'
            },
            {
                test: /jquery/,
                loader: 'expose-loader?$!expose-loader?jQuery'
            }
        ]
    };

    config.plugins = [

    ];

    config.resolve = {
        extensions: ['.ts', '.js', '.css', '.html']
    };

    return config;
}();

main.aot.ts main.aot.ts

import { platformBrowser } from '@angular/platform-browser';

import { AppModuleNgFactory } from '../compiled/app/app.module.ngfactory';

let Highcharts = require('highcharts/highstock');
require('highcharts/modules/map')(Highcharts);
require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts);
require('highcharts/modules/exporting')(Highcharts);

platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

I am using angular v4.1.0 and webpack v2.4.1. 我正在使用angular v4.1.0和webpack v2.4.1。

Has anyone encountered something similar? 有没有人遇到过类似的事情?

Maybe it's too late, but try to add <meta charset="utf-8"> to your index.html. 也许为时已晚,但是尝试将<meta charset="utf-8">到您的index.html中。 The reason is that Angular requires utf-8 ( https://github.com/angular/angular/issues/15638#issuecomment-293084801 ) 原因是Angular需要utf-8( https://github.com/angular/angular/issues/15638#issuecomment-293084801

Source: https://github.com/angular/angular/issues/15008#issuecomment-294234685 来源: https : //github.com/angular/angular/issues/15008#issuecomment-294234685

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular 8 webpack AOT 构建失败 - 无法读取未定义的属性“地图” - Angular 8 webpack AOT build failed - Cannot read property 'map' of undefined 无法读取未定义的属性“ initialNavigation”-Angular v4 AoT - Cannot read property 'initialNavigation' of undefined - Angular v4 AoT angular:matTable在不使用--aot进行编译时给出错误“无法读取未定义的属性&#39;find&#39;” - angular: matTable giving error “cannot read property 'find' of undefined” when compiling without --aot 角度AOT-UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝ID:#):TypeError:无法读取未定义的属性“ request” - Angular AOT - UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: #): TypeError: Cannot read property 'request' of undefined 无法读取未定义的属性“ then” - Cannot read property 'then' of undefined 无法读取未定义的属性“” - Cannot read property '' of undefined 无法读取未定义的属性&#39;&#39; - Cannot read property ' ' of undefined 无法读取未定义的属性&#39;of&#39; - Cannot read property 'of' of undefined 无法读取未定义的属性“*******” - Cannot read property “*******”' of undefined 无法读取未定义的属性“ 0” - Cannot read property ‘0’ of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM