Skip to content

fix: replace extension with .ngfactory.ts#4262

Closed
olivercs wants to merge 4 commits into
angular:masterfrom
olivercs:master
Closed

fix: replace extension with .ngfactory.ts#4262
olivercs wants to merge 4 commits into
angular:masterfrom
olivercs:master

Conversation

@olivercs

Copy link
Copy Markdown

Fix to issue #4238

@Meligy

Meligy commented Jan 28, 2017

Copy link
Copy Markdown
Contributor

@olivercs Please check the build error.

Also can this have an e2e test?

Thanks.

@filipesilva filipesilva requested a review from hansl January 28, 2017 11:54
@olivercs

olivercs commented Feb 3, 2017

Copy link
Copy Markdown
Author

@Meligy not sure how to do it.

const dirName = path.normalize(path.dirname(refactor.fileName));
const entryModule = plugin.entryModule;
const entryModuleFileName = path.normalize(entryModule.path + '.ngfactory');
const entryModuleFileName = path.normalize(entryModule.path.replace(/\.ts$/, '.ngfactory.ts'));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a bug where the path does NOT include .ts at the end.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hansl, is safe to append the string '.ngfactory.ts' in that particular case?

 if( extension === '.ts' ) {
 	entryModuleFileName = path.normalize(entryModule.path.replace(/\.ts$/, '.ngfactory.ts'));
 }else if(extension === '') {
 	entryModuleFileName = path.normalize(entryModule.path + '.ngfactory.ts');
 }


refactor.insertImport('platformBrowser', '@angular/platform-browser');
refactor.insertImport(entryModule.className + 'NgFactory', ngFactoryPath);
refactor.insertImport(entryModule.className + 'NgFactory', ngFactoryPath + '.ngfactory.ts');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import A from 'some/path/file.ngfactory.ts'

is wrong. You should not include the ts itself in the import path.

@Brocco

Brocco commented May 24, 2017

Copy link
Copy Markdown
Contributor

Corresponding issue has been closed as obsolete, closing this PR.

@Brocco Brocco closed this May 24, 2017
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants