jvandemo / jvandemo/generator-angular2-library

Components with inline templates (with commented out 'templateUrl')

Open
#243 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
740
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Components with _commented-out templateUrl_ still throw a build error. For example, from this simple component

@Component({
selector: 'common-html-entry',
// templateUrl: 'common-html-entry.html',
template: `



`
})
export class CommonHtmlEntryComponent { ...

I get the following build error:

[10:33:00] Starting 'inline-resources'...
An error occured: { Error: ENOENT: no such file or directory,
open'/home/harry/.../.tmp/components/common-html-entry/common-html-entry.html'
at Error (native)
at Object.fs.openSync (fs.js:642:18)
at Object.fs.readFileSync (fs.js:510:33)
at /home/harry/.../tools/gulp/inline-resources.js:83:32
at RegExp.[Symbol.replace] (native)
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at inlineTemplate (/home/harry/.../tools/gulp/inline-resources.js:81:18)
at reduce (/home/harry/.../tools/gulp/inline-resources.js:70:29)
at Array.reduce (native)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/home/harry/.../.tmp/components/common-html-entry/common-html-entry.html' }

It looks like `templatUrl` takes precedence (even it it's commented out) over the inline html template.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in tools/gulp/inline-resources.js, especially the logic around lines 70-83, and reproduce the issue with the component shown in the report. Verify that a commented-out templateUrl no longer causes a missing-file error and that the inline template is used successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.