我正在尝试创建Angular 2样本ngc和JIT编译器 . 使用JIT编译器,我可以运行示例但是使用ngc编译器时遇到了component.html文件路径的问题 .

npm run ngc ejangular2-systemjs-starter@1.0.0 ngc E:\ AOT \ seed-application-changes \ sample-AOT“node”copy-dist-files.js && rollup -c rollup-config.js && ngc - p tsconfig-aot.json错误:编译失败 . 找不到资源文件:E:/ AOT / seed-application-changes / sample-AOT / src / src / app . 在CompilerHost.loadResource的ModuleResolutionHostAdapter.readResource(E:\ AOT \ seed-application-changes \ sample-AOT \ node_modules \ @a ngular \ compiler-cli \ src \ compiler_host.js:291:19)中的component.html(E:在Object.get上的\ AOT \ seed-application-changes \ sample-AOT \ node_modules \ @angular \ compiler -cli \ src \ compiler_host.js:230:85)(E:\ AOT \ seed-application-changes \ sample- AOT \ node_modules \ @angular \ compiler \ bundles \ compil er.umd.js:26365:111)在DirectiveNormalizer._fetch(E:\ AOT \ seed-application-changes \ sample-AOT \ node_modules \ @angular \ compile r \ bundles \ compiler.umd.js:13744:47)在DirectiveNormalizer.normalizeTemplateAsync(E:\ AOT \ seed-application-changes \ sample-AOT \ node_modules \ @angular \ compiler \ bundles \ compiler.umd.js:13790:25 )

以下是我的配置 .

sample structure

rollup.config.js

import nodeResolve from 'rollup-plugin-node-resolve'
 import commonjs    from 'rollup-plugin-commonjs';
 import uglify      from 'rollup-plugin-uglify'

export default {
entry: 'src/main.js',
dest: 'aot/build.js', // output a single application bundle
sourceMap: false,
format: 'iife',
onwarn: function(warning) {
// Skip certain warnings

// should intercept ... but doesn't in some rollup versions
if ( warning.code === 'THIS_IS_UNDEFINED' ) { return; }
// intercepts in some rollup versions
if ( warning.indexOf("The 'this' keyword is equivalent to 'undefined'") > -1    ) { return; }

// console.warn everything else
console.warn( warning.message );
  },
plugins: [
  nodeResolve({jsnext: true, module: true}),
  commonjs({
    include: 'node_modules/rxjs/**',
  }),
  uglify()
 ]
}

tsconfig-aot.json

{
 "compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
 },

 "files": [
"src/app.module.ts",
"src/main-aot.ts"
 ],

 "angularCompilerOptions": {
  "genDir": "aot",
    "skipMetadataEmit" : true
   }
   }

package.json

"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"tsc": "tsc",
"tsc:w": "tsc -w",
"ngc": "\"node\" copy-dist-files.js && rollup -c rollup-config.js && ngc -p   tsconfig-aot.json",
"serve": "lite-server -c bs-config.aot.json"
},