我正尝试将我们的angular 5应用程序更新为angular 6,并且目前正在使用awesome-typescript loader遇到构建问题。
完整的错误消息是
C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5
compiler.hooks.run.tapAsync('at-loader', function(params, callback) {
^
TypeError: Cannot read property 'run' of undefined
at CheckerPlugin.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5:18)
at Compiler.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\tapable\lib\Tapable.js:375:16)
at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:33:19)
at options.map.options (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:55)
at Array.map (<anonymous>)
at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:40)
at processOptions (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:335:15)
at yargs.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:397:2)
at Object.Yargs.self.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\node_modules\yargs\yargs.js:533:18)
at Object.<anonymous> (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:152:7)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Angular.Web.App@1.0.0-rc3 build:webpack: `webpack --progress --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Angular.Web.App@1.0.0-rc3 build:webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_890Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Angular.Web.App@1.0.0-rc3 build:dev: `npm run build:vendor && npm run build:webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Angular.Web.App@1.0.0-rc3 build:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_936Z-debug.log
这是必需的,因为我们的Webpack正在拉入其CheckerPlugin
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
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 ? ['angular2-template-loader', 'angular2-router-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' },
...sharedModuleRules
]
},
plugins: [new CheckerPlugin()]
};
使用awesome-typescript-loader版本5.0.0的枚举