awesome-typescript-loader icon indicating copy to clipboard operation
awesome-typescript-loader copied to clipboard

@types errors and not just on building

Open costea93 opened this issue 7 years ago • 0 comments

I saw this problem discussed many times here, and a lot of solutions, but none of them work for me.

this is my tsconfig.json

{
  "compilerOptions": {
    "target": "es2015",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": ["es2015", "dom"],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "types": ["node", "core-js"]
  }
}

and this is my webpack.config.js

var isDevBuild = process.argv.indexOf('--env.prod') < 0;
var path = require('path');
var webpack = require('webpack');
var nodeExternals = require('webpack-node-externals');
var merge = require('webpack-merge');
const { CheckerPlugin } = require('awesome-typescript-loader');

var sharedConfig = {
    resolve: {
        extensions: ['', '.ts', '.tsx', '.js', '.jsx']
    },
    output: {
        filename: '[name].js',
        publicPath: path.join(__dirname, 'dist/')
    },
    devtool: 'source-map',
    module: {
        rules: [{
            test: /\.scss$/,
            use: [{
                loader: "style-loader"
            }, {
                loader: "css-loader"
            }, {
                loader: "sass-loader"
            }]
        }],
        loaders: [
            {
                test: /\.ts$/,
                loaders: [
                    'awesome-typescript-loader',
                    'angular2-template-loader'],
                exclude: [/node_modules\/(?!(ng2-.+))/]
            },
            { test: /\.html$/, loader: 'raw' },
            { test: /\.scss/, loader: 'css-to-string-loader!css-loader!sass-loader'},
            { test: /\.css$/, loader: 'to-string!css' },
            { test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url', query: { limit: 25000 } }
        ]
    },
    plugins: [
        new CheckerPlugin()
    ]
};
var clientBundleConfig = merge(sharedConfig, {
    entry: { 'main-client': './src/boot-client.ts' },
    output: { path: path.join(__dirname, '../wwwroot/dist') },
    devtool: isDevBuild ? 'inline-source-map' : null,
    plugins: [
        new webpack.DllReferencePlugin({
            context: __dirname,
            manifest: require('../wwwroot/dist/vendor-manifest.json')
        })
    ].concat(isDevBuild ? [] : [
        // Plugins that apply in production builds only
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.optimize.UglifyJsPlugin()
    ])
});
var clientBundleConfig = merge(sharedConfig, {
    entry: { 'main-client': './src/boot-client.ts' },
    output: { path: path.join(__dirname, '../wwwroot/dist') },
    devtool: isDevBuild ? 'inline-source-map' : null,
    plugins: [
        new webpack.DllReferencePlugin({
            context: __dirname,
            manifest: require('../wwwroot/dist/vendor-manifest.json')
        })
    ].concat(isDevBuild ? [] : [
        // Plugins that apply in production builds only
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.optimize.UglifyJsPlugin()
    ])
});

module.exports = [clientBundleConfig];

when i build getting a lot of errors:

ERROR in [at-loader] TS2468: Cannot find global value 'Promise'.

ERROR in [at-loader] ./node_modules/@angular/cdk/portal/typings/portal-injector.d.ts:17:59 
    TS2304: Cannot find name 'WeakMap'.

ERROR in [at-loader] ./node_modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts:12:32 
    TS2304: Cannot find name 'Iterable'.

ERROR in [at-loader] ./node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts:14:48 
    TS2304: Cannot find name 'Iterable'.

ERROR in [at-loader] ./node_modules/@angular/material/chips/typings/chip-list.d.ts:44:25 
    TS2304: Cannot find name 'WeakMap'.

ERROR in [at-loader] ./node_modules/@types/core-js/index.d.ts:39:27 
    TS2304: Cannot find name 'IterableIterator'.

ERROR in [at-loader] ./node_modules/@types/core-js/index.d.ts:47:36 
    TS2304: Cannot find name 'Iterable'.

ERROR in [at-loader] ./node_modules/@types/core-js/index.d.ts:229:38 
    TS2304: Cannot find name 'IterableIterator'.

ERROR in [at-loader] ./node_modules/@types/core-js/index.d.ts:234:35 
    TS2304: Cannot find name 'IterableIterator'.

ERROR in [at-loader] ./node_modules/@types/core-js/index.d.ts:239:37 
    TS2304: Cannot find name 'IterableIterator'.

How can i fix that?

costea93 avatar Dec 14 '17 15:12 costea93