私はAngular2を使用しており、AOTを使用してコードをプレコンパイルしています。Angular2 - コンポーネントtemplateUrlで絶対パスを使用してAOTにコンパイル
コンポーネントのtemplateUrlで相対パスを使用しているときにコードをコンパイルできます。
しかし、コンポーネントのtemplateUrl
コンパイルコマンドで絶対パスを使用した場合、コンパイルが失敗している:絶対templateUrlを使用している間、私はエラーの下に取得しています"node_modules/.bin/ngc" -p tsconfig-aot.json
:
Error: Compilation failed. Resource file not found: {Absolute htmlUrl path} at ModuleResolutionHostAdapter.readResource (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler-cli\src\compiler_host.js:291:19) at CompilerHost.loadResource (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler-cli\src\compiler_host.js:230:85) at Object.get (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler\bundles\compiler.umd.js:26374:111) at DirectiveNormalizer._fetch (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler\bundles\compiler.umd.js:13753:47) at DirectiveNormalizer.normalizeTemplateAsync (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler\bundles\compiler.umd.js:13799:25) at DirectiveNormalizer.normalizeTemplate (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler\bundles\compiler.umd.js:13771:48) at CompileMetadataResolver._loadDirectiveMetadata (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler\bundles\compiler.umd.js:18074:79) at C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler\bundles\compiler.umd.js:18250:58 at Array.forEach (native) at CompileMetadataResolver.loadNgModuleDirectiveAndPipeMetadata (C:\Dipendra\stash-workspace\angular2Aot\WebContent\node_modules\@angular\compiler\bundles\compiler.umd.js:18249:45) Compilation failed