AOT样本

时间:2017-04-06 04:59:05

标签: json angular angular2-aot

我正在尝试创建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&&汇总-c rollup-config.js&& ngc -p tsconfig-aot.json   错误:编译失败。找不到资源文件:E:/ AOT / seed-application-changes / sample-AOT / src / src / app。   component.html       在ModuleResolutionHostAdapter.readResource(E:\ AOT \ seed-application-changes \ sample-AOT \ node_modules \ @a   ngular \编译-CLI \ SRC \ compiler_host.js:291:19)       在CompilerHost.loadResource(E:\ AOT \ seed-application-changes \ sample-AOT \ node_modules \ @angular \ compiler   -cli \ SRC \ compiler_host.js:230:85)       at Object.get(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 \束\ compiler.umd.js:13744:47)       在DirectiveNormalizer.normalizeTemplateAsync(E:\ AOT \ seed-application-changes \ sample-AOT \ node_modules \   @angular \编译\束\ 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"
},

0 个答案:

没有答案