-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unable to override addon re-exports in the consumer application #5336
Comments
I've checked if it's reproducible for another kind of files(coffeescript). So if you have the following addon: And the consumer application which tries to extend component from addon: |
I'm also getting this for the application template in https://github.com/locks/ember-welcome-page. |
I believe this was addressed by: stefanpenner/fs-tree-diff@8a8cf15 |
Unfortunately no. I've updated reproduction app to use ember-cli@2.8.0 and have exactly the same error.
@stefanpenner could you please reopen? |
Maybe it's better to add a pr with a failing test here? |
Does this throw an error in a consuming application which is separate from the dummy app? The mental model here is that an addon is "pushing" something into the app's namespace. It's reasonable for that to error upon collision. I personally prefer that consumers of an addon handle this sort of thing via explicit imports from the addon's namespace which neatly sidesteps the problem and is more similar to our proposed future state. I'm leaving this closed for now, but in the mean time we will still continue to receive notifications from any followup comments on this issue; being closed doesn't mean that we're ignoring the thread. (Stef closed ~30 on me in one day, so it's taking a while to get through the backlog.) |
@nathanhammond thanks for your response.
now I can see it works in an opposite order.
Yes. #5336 (comment) This issue still makes me think that something is wrong here.
build finishes successfuly and Then when I build this:
build fails with an EEXIST exception. From my point of view here should not be a difference for a build result between these two use cases. |
updated issue description. Mostly dropped irrelevant blocks of text and mentioned that issue is reproducible for separate app + adddon(not only for dummy app). |
Still having this issue. Is it not possible to create a template in the addon and the exact template in the consumer app and have them work? |
I've believed for a moment that #6480 might solve this issue. Unfortunately it doesn't. Trying to debug this I've wrapped https://github.com/stefanpenner/broccoli-persistent-filter/blob/master/index.js#L146 with a try {
return this._handleFile(relativePath, srcDir, destDir, entry, outputFilePath, false, instrumentation);
} catch (e) {
console.log("patches", patches);
throw e;
} At the moment when the error happens:
We have the following patches:
According to patches both of these nodes should be created. But while applying patches they implicitly have the same output path after processing => update: updated descriptions for patch entries |
Ah, that debugging i believe makes me understand the issue. basically we have two files dummy/templates/test.js // from the addons app directory
dummy/templates/test.hbs // from the app directory Which really represent the same thing, but during the So when the apps template compiler performed I believe the fix is
|
As you can see from patches dumped above template re-export from addon tries to override .hbs template from the host. When the error happens:
/tmp/template_compiler-output_path-VGoDY8CT.tmp/dummy/templates/test.js actually contains compiled handlebars template from the host app. Then the next patch(which contains template re-export from addon) tries to by applied and the error happens. @stefanpenner this means if we try to unlink like you propose we just allow addon re-export override application template. I feel the current exception is a right behavior. the invalid part is what we do have in a patches collection. |
Ah that then seems like a second issue. Will try and investigate this weekend. |
yes, but that's what actually causes the issue. looks like while @host-app/app/templates/ and @addon/app/templates trees are merging, both hbs and js files are merged to the same destination despite their output file extensions after processing. |
@ro0gr ya, that actually make this tricky. hmm.. |
I'm working around this for now by doing // tests/dummy/app/templates/components/freestyle-palette-item.js
import hbs from 'htmlbars-inline-precompile';
export default hbs`
<div>my template</div>
`; |
A simple workaround for that problem: Target: 1 - We create a new folder and a component with same name 2 - Create a template regarding that previous path 3 - We extend the component and we assign the new template: // [our-app]/components/[addon-name]/foo.js
import Foo from '[addon-name]/components/foo.js';
// Workaround: It's not possible to override the template straight away using same path
// https://github.com/ember-cli/ember-cli/issues/5336
export default Foo.extend({
templateName: 'components/[addon-name]/foo.hbs',
}); 4 - Call |
Note: But you can |
repo with reproduction. This reproduction is based on a dummy app but it's also reproducible within a host app.
Steps to reproduce:
produces following files:
Now if you run the build it will fail with an
EEXIST
exception:As I can see after some debugging it happens when broccoli tries to save compiled
tests/dummy/app/templates/test.hbs
to thetests/dummy/app/templates/test.js
where theapp/templates/test.js
is merged already.A little bit strange but this error happens only on cold starts and works ok on rebuilds.
The text was updated successfully, but these errors were encountered: