-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve the template compiler from ember-source instead of project root #696
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -317,10 +317,6 @@ class CompatAppAdapter implements AppAdapter<TreeNames> { | |
return this.configTree.readConfig().rootURL; | ||
} | ||
|
||
templateCompilerPath(): string { | ||
return 'ember-source/vendor/ember/ember-template-compiler'; | ||
} | ||
|
||
strictV2Format() { | ||
return false; | ||
} | ||
|
@@ -377,6 +373,13 @@ class CompatAppAdapter implements AppAdapter<TreeNames> { | |
}; | ||
} | ||
|
||
@Memoize() | ||
resolveTemplateCompilerPath() { | ||
let emberSource = this.oldPackage.app.project.findAddonByName('ember-source'); | ||
let templateCompilerPath = emberSource.absolutePaths.templateCompiler; | ||
return templateCompilerPath; | ||
Comment on lines
+378
to
+380
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes away from resolving the template compiler relative to the vendor asset output to resolving it in normal node modules resolution system. This means that it would be no longer possible for folks to provide a custom / overridden ember-template-compiler asset (before all they needed to do was put it in the right location in their vendor folder). I think this might be perfectly fine, but I'm not 100% sure... |
||
} | ||
|
||
// unlike `templateResolver`, this one brings its own simple TemplateCompiler | ||
// along so it's capable of parsing component snippets in people's module | ||
// rules. | ||
|
@@ -392,9 +395,10 @@ class CompatAppAdapter implements AppAdapter<TreeNames> { | |
|
||
// It's ok that this isn't a fully configured template compiler. We're only | ||
// using it to parse component snippets out of rules. | ||
|
||
resolver.astTransformer( | ||
new TemplateCompiler({ | ||
compilerPath: resolveSync(this.templateCompilerPath(), { basedir: this.root }), | ||
compilerPath: this.resolveTemplateCompilerPath(), | ||
EmberENV: {}, | ||
plugins: {}, | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this is actually trying to resolve the path relative to the build itself. That is why it is
ember-source/vendor/ember-template-compiler.js
instead of where it actually is in the npm packageember-source/dist/ember-template-compiler.js
.This is where that is done:
https://github.com/emberjs/ember.js/blob/eff00a35624cd33f9f46f0991252182c367bb045/lib/index.js#L298-L300