TS1128错误 - 角度4.4.6产品构建失败

时间:2018-04-02 16:39:08

标签: angular

我试图弄清楚我是否有一个Angular错误,或者它是否是某种配置问题。 Angular 4.4.6 w / CLI和@ ngtools / webpack就是我正在使用的 我重现的场景是:

1)我正在本地开发,并且能够在ts文件中构建和部署,例如和额外的花括号或逗号有时候有时候,有时候这部分不是很可量化的,我知道,但我只是说实话

2)我能够进行更改,Angular的CLI重新加载可以解决问题

3)我在我的管道中通过它并且构建失败,并显示以下消息:

build stacktrace

因此,简而言之,它构建,部署和工作只是在本地查找,尽管有一些轻微的语法错误。但是在部署prod时构建失败。

像这样的东西很容易错过(不计算linter或hinter,b / c Visual Studio 2017 hinter在编译时没有选择它...至少不是马上就可以了) 只是想知道是否有人在我创建一个带有Angular

的bug之前遇到过这个问题

****编辑*******

摘自package.json:

"scripts": {
"lint": "tslint --project . --force",
"test": "karma start ClientApp/test/karma.conf.js",
"start": "webpack --config webpack.config.vendor.js",
"postinstall": "webpack --config webpack.config.vendor.js",
"build": "webpack --config webpack.config.vendor.js -p --env=prod && webpack -p --env=prod"

},

摘自webpack.config.js:

 module.exports = (env) => {
// Configuration in common to both client-side and server-side bundles
const isDevBuild = !(env && env.prod);
const sharedConfig = {
    stats: { modules: false },
    context: __dirname,
    resolve: { extensions: ['.js', '.ts'] },
    output: {
        filename: '[name].js',
        publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
    },
    module: {
        rules: [
            {
                test: /\.ts$/, use: isDevBuild ? ['awesome-typescript-loader', 'angular-router-loader', 'angular2-template-loader'] : '@ngtools/webpack'
            },
            { test: /\.html$/, use: 'html-loader?minimize=false' },
            { test: /\.css$/, use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize'] },
            { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }

        ]
    },
    plugins: [new CheckerPlugin()]
};

0 个答案:

没有答案
相关问题