错误:[at-loader] .TS2304:找不到名称'Set'

时间:2017-06-27 15:34:31

标签: ts-loader

我正在使用AoT构建我的MEAN项目,我收到此错误,我尝试更改许多加载器配置。但似乎没有任何效果

[at-loader] Checking finished with 40 errors
Error in bail mode: [at-loader] ./node_modules/@angular/common/src/directives/ng_class.d.ts:48:34
TS2304: Cannot find name 'Set'.

我的ts.config是

 {
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "outDir": "./public/js/app"
  },
  "typeRoots": [
    "node_modules/@types"
  ],
  "lib": [
    "es5",
    "dom"
  ],
  "types": [
    "hammerjs",
    "node"
  ],
  "angularCompilerOptions": {
    "skipMetadataEmit": true
  }
}

我的常见webpack.config是

    var webpack = require('webpack');

    module.exports = {
        entry: {
            'app': './assets/app/main.ts'
        },

        resolve: {
            extensions: ['.js', '.ts']
        },

        module: {
            rules: [
                {
                    test: /\.html$/,
                    use: [{ loader: 'html-loader' }]
                },
                {
                    test: /\.css$/,
                    use: [{ loader: 'raw-loader' }]
                }
            ],
            exprContextCritical: false

        }
    };

aot webpack.config是

    var path = require('path');

    var webpack = require('webpack');
    var webpackMerge = require('webpack-merge');
    var commonConfig = require('./webpack.config.common.js');

    module.exports = webpackMerge.smart(commonConfig, {
        entry: {
            'app': './assets/app/main.aot.ts'
        },

        output: {
            path: path.resolve(__dirname + '/public/js/app'),
            filename: 'bundle.js',
            publicPath: '/js/app/',
            chunkFilename: '[id].[hash].chunk.js'
        },

        module: {
            rules: [
                {
                    test: /\.ts$/,
                    use: [
                        'awesome-typescript-loader',
                        'angular2-template-loader',
                        'angular-router-loader?aot=true'
                    ]
                }
            ]
        },

        plugins: [
            new webpack.optimize.UglifyJsPlugin({
                sourceMap: false
            })
        ]
    });

0 个答案:

没有答案