You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/release/configuring-ember/build-targets.md
+4-10Lines changed: 4 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
By default, Ember apps are built with Vite. The toolchain uses Babel (alongside modern compilers like esbuild/Rollup) so you can write current-generation JavaScript and TypeScript with confidence.
1
+
By default, Ember apps are built with Vite. The toolchain uses Babel, esbuild, and Rollup so you can write current-generation JavaScript and TypeScript while still allowing your application to work with older browsers.
2
2
3
3
Rather than always compiling everything down to legacy syntax, Ember determines what—if anything—needs to be transformed based on the browsers you target. With today’s defaults aimed at evergreen browsers, many features (ES modules, classes, arrow functions, async/await, etc.) ship largely as-is.
4
4
5
-
Why does this matter? Over-transpiling to very old JavaScript increases bundle size and slows parsing. As the web platform has advanced and legacy browsers have faded, Ember’s defaults avoid unnecessary transforms to keep apps smaller and faster.
5
+
Why does this matter? Over-transpiling to very old JavaScript increases bundle size, slows parsing, and in some cases can slow down the execution of your JavaScript code. As the Web platform has advanced and percentage of users on legacy browsers have decreased, Ember’s default targets avoid unnecessary transforms to keep apps smaller and faster.
6
6
7
-
That’s why the build respects your browser targets: set the targets for your app and the compiler applies only the minimal transforms and polyfills required for those browsers.
7
+
If you need to update the defaults for any reason (i.e. need to target a very legacy browser), you can set the targets for your app and the compiler applies only the minimal transforms and polyfills required for those browsers.
8
8
9
9
If you open `config/targets.js`, you will find the following code:
10
10
@@ -22,7 +22,7 @@ module.exports = {
22
22
};
23
23
```
24
24
25
-
If you inspect the compiled code, you’ll see many modern features (like arrow functions and async/await) preserved when your targets support them.
25
+
If you inspect your compiled code after running a build with `npm run build`, you'll see that many modern features (like arrow functions and async/await) preserved when your targets support them.
26
26
27
27
This feature is backed by [Browserslist](https://github.com/ai/browserslist) and [Can I Use](https://caniuse.com/).
28
28
These websites track usage stats of browsers, so you can use complex queries based on the user base of every browser.
@@ -37,9 +37,3 @@ module.exports = {
37
37
```
38
38
39
39
It is very important that you properly configure the targets of your app so you get the smallest and fastest code possible.
40
-
41
-
Build targets can also be leveraged in other ways.
42
-
43
-
Some addons might conditionally include polyfills only if needed.
44
-
Some linters may emit warnings when using features not yet fully supported in your targets.
45
-
Some addons may even automatically prefix unsupported CSS properties.
0 commit comments