-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
[BUGFIX lts] Compile Ember dynamically in consuming applications #18208
Conversation
ae86d5c
to
f4229fb
Compare
Looks like the CI failures are related:
|
Just a heads up, this PR may not be enough. Currently in ember-source 3.11 when native extends is mixed with
It passes when:
You can reproduce this by:
This test will fail and you will find |
Based on your description @runspired, this PR should fix those issues as well. I believe the problem is the same as #18084, where specific targets are causing us to ship the wrong build and causing the conflict. With this PR, we will be compiling Ember using the same targets as the consuming application, so this type of conflict won't be possible anymore. |
Hello everyone, when do you think this problem can be solved? We need our production applications to run on ios9, now for several weeks we are having trouble. The only solution we have now is to edit the build of applications after each deployment by replacing all |
Hey, sorry, have been working on perf tuning for tracked properties in 3.13 this last week. I'm wrapping that up, should be able to get to this sometime this week. |
810550e
to
de69708
Compare
de69708
to
2ac757a
Compare
b4de6b7
to
e1c0e0c
Compare
This PR sets up Ember to do a two phase build: * **Phase 1, prepublish:** Run Typescript and Rollup on the main Ember packages, and strip out canary-features. Publish these packages, along with the dependencies for Ember, in the `dist/` folder. * **Phase 2, in addon:** Run Babel transpilation using the consumer's `ember-cli-babel` and Babel configuration on the dist packages and dependencies, and bundle up the final `ember.js` file to serve to apps. This also includes `debug` flags and, in theory, svelting. Two major changes that will occur because of this: 1. We will no longer be distributing `ember.prod.js`, `ember.debug.js`, `ember.min.js`, or `ember-testing.js`. These files existing may be something that people rely on, and the packages that _are_ distributed aren't quite ready to build in a "normal" way, using webpack or another bundler. 2. We will no longer be _building_ `ember.prod.js`, `ember.min.js`, or `ember.debug.js` at all, only a single `ember.js` file. We no longer need separate builds, because the environment settings of the build will handle the differences for us. We _are_ continuing to distribute a pre-built version of the `ember.js` and `ember-testing.js` files. These are used only in the case where the build targets match the default development build targets for Ember apps, providing a small optimization for users' dev workflow. Unfortunately, until we disentangle `ember-cli` from the implementation details of `ember-source` we cannot convert Ember to _build_ like a normal addon locally. Using the `EmberAddon` class blows up in many small ways.
e1c0e0c
to
e526a04
Compare
|
||
/** | ||
* There isn't a way for us to override targets through ember-cli-babel, and we | ||
* don't want to introduce that functionality for reasons. This is a quick and |
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.
I'd like to address this over in ember-cli-babel (in a follow up), would you mind making an issue over there about the general use case?
Hi ! is this pull request can be merged into ember 3.12.x or 3.11.x ? |
This is marked for backport to LTS, so it will be backported to 3.12 for sure |
if (!isProduction && PRE_BUILT_TARGETS.every(target => targets.includes(target))) { | ||
ember = new Funnel(tree, { | ||
destDir: 'ember', | ||
include: ['ember.debug.js', 'ember.debug.map', 'ember-testing.js', 'ember-testing.map'], |
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.
Should ember-template-compiler.js
be present here as well?
This change might have caused this: embroider-build/embroider#311.
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.
That seems plausible, mind making a PR so we can focus discussion over there?
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.
That's done at #18291.
why is this PR marked as "BUGFIX lts"? the description is not mentioning any bugs that are being fixed by this and it seems like a pretty significant change for those that expect LTS to work the same way as before 🤔 |
@Turbo87 - There is a whole category of issues that this PR will ultimately resolve. A few examples:
These changes are currently only in beta (3.13.0-beta.3 I think?), and will only be backported to LTS (likely 3.12 if we do it, not 3.8) if we can be extremely certain that they will not cause more issues than it solves. |
Has this been backported to 3.12? Is this something I can help with. This is the internal addon we have to fix this temporarily (we are on 3.12) 'use strict';
const replace = require('broccoli-replace');
module.exports = {
name: 'temporary-ember-fix',
postprocessTree(type, tree) {
if (type !== 'all') {
return tree;
}
return replace(tree, {
files: ['**/vendor*.js'],
patterns: [{
match: /const\s/g,
replacement: 'var '
}]
});
},
isDevelopingAddon() {
return true;
}
}; |
I don't believe it has yet, but it definitely should be. It's a large change, but it's been pretty stable so far, no more issues, and it shouldn't be too hard to pull it onto 3.12 (originally we were hoping to get it in then, but we decided against it since we didn't have enough time for testing). If you can take a crack at it, that'd be very helpful, otherwise I'll try to find some time in the near future to get it going. |
Ya, the major thing to do is identify all the bugfix commits for these files that happened after this initially landed so we have a clearer idea of what to backport. |
TBH, I don't know. We really need to figure out the full list of changes needed to backport, that is probably the main blocker. If someone has time to dig through the commit history for anything build related since this PR landed and make a PR targetting the |
FWIW I made https://github.com/pzuraq/ember-class-constructor-fix which should fix most of the general issues in older builds. It's a more general fix too, which means it'll work prior to 3.12 as well. #18084 is particularly strange though, since it appears that the legacy build is not being used, despite very clear legacy targets. Will comment over there to try to get more details. |
This is phenomenal! I love the approach. Is this the fix or is backporting changes the fix? Seems like the former? (if the latter, I can help today and this weekend) |
I think backporting would still be useful, if possible, but I don't think we need to spend extra cycles on it. This fix should work in any cases where we eagerly opt into the legacy build even if we shouldn't actually do that, and as I was working through the fix I thought that was the only possible thing that could accidentally happen. This is why #18084 is so strange to me, based on the code I don't think it should be possible. We basically only opt-into legacy IFF classes need to be compiled OR another feature needs to be compiled, so
I don't think it should be possible for user classes to be compiled, and for the framework to not be the legacy build, but maybe there's something I wasn't considering. |
This PR sets up Ember to do a two phase build: * **Phase 1, prepublish:** Run Typescript and Rollup on the main Ember packages, and strip out canary-features. Publish these packages, along with the dependencies for Ember, in the `dist/` folder. * **Phase 2, in addon:** Run Babel transpilation using the consumer's `ember-cli-babel` and Babel configuration on the dist packages and dependencies, and bundle up the final `ember.js` file to serve to apps. This also includes `debug` flags and, in theory, svelting. Two major changes that will occur because of this: 1. We will no longer be distributing `ember.prod.js`, `ember.debug.js`, `ember.min.js`, or `ember-testing.js`. These files existing may be something that people rely on, and the packages that _are_ distributed aren't quite ready to build in a "normal" way, using webpack or another bundler. 2. We will no longer be _building_ `ember.prod.js`, `ember.min.js`, or `ember.debug.js` at all, only a single `ember.js` file. We no longer need separate builds, because the environment settings of the build will handle the differences for us. We _are_ continuing to distribute a pre-built version of the `ember.js` and `ember-testing.js` files. These are used only in the case where the build targets match the default development build targets for Ember apps, providing a small optimization for users' dev workflow. Unfortunately, until we disentangle `ember-cli` from the implementation details of `ember-source` we cannot convert Ember to _build_ like a normal addon locally. Using the `EmberAddon` class blows up in many small ways. [BUGFIX lts] Updates based on feedback Cherry-picked from PR emberjs#18208
Phase 1, prepublish: Run Typescript and Rollup on the main Ember
packages, and strip out canary-features. Publish these packages, along
with the dependencies for Ember, in the
dist/
folder.Phase 2, in addon: Run Babel transpilation using the consumer's
ember-cli-babel
and Babel configuration on the dist packages anddependencies, and bundle up the final
ember.js
file to serve toapps. This also includes
debug
flags and, in theory, svelting.Two major changes that will occur because of this:
ember.prod.js
,ember.debug.js
,ember.min.js
, orember-testing.js
. These files existing may besomething that people rely on, and the packages that are
distributed aren't quite ready to build in a "normal" way, using
webpack or another bundler.
ember.prod.js
,ember.min.js
, orember.debug.js
at all, only a singleember.js
file. We no longerneed separate builds, because the environment settings of the build
will handle the differences for us.
Unfortunately, until we disentangle
ember-cli
from the implementationdetails of
ember-source
we cannot convert Ember to build like anormal addon locally. Using the
EmberAddon
class blows up in manysmall ways.