s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

TS1056: Accessors are only available when targeting ECMAScript 5 and higher. #640

Open guoliang opened 5 years ago

guoliang commented 5 years ago

I'm running webpack with awesome-typescript-loader, and I get the error saying that Accessors are only available with es5. The thing is that in my tsconfig.json it already says target is es5. But somehow the loader doesn't pick it up.

My webpack config looks as following

const path = require("path");

module.exports = {
    entry: "./src/appbuilder/designer/app.ts",
    output: {
        path: path.resolve(__dirname, "dist"),
        filename: "appbuilder.js"
    },
    resolve: {
        extensions: [".ts", ".tsx", ".js", ".jsx"],
    },
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                loader: "awesome-typescript-loader",
                options: {
                    configFileName: path.resolve(__dirname, "appbuilder/tsconfig.json")
                }
            }
        ]
    },
};

And my tsconfig.json looks like following

{
    "compileOnSave": true,
    "compilerOptions": {
        "declaration": true,
        "noImplicitAny": true,
        "noImplicitReturns": true,
        "preserveConstEnums": true,
        "sourceMap": true,
        "target": "es5"
    }
}

Is there some obvious errors in my configurations?