This addon allow to have 2 builds (bundles) (for modern and legacy browsers) in one time.
(module, nomodule)
Pre-RFC: Generate and serve ES2015 assets
Alternatives:
- Ember.js v2.18 or above
- Ember CLI v2.13 or above
- Node.js v8 or above
ember install ember-cli-fallback-builds
Configure your config/targets.js
:
process.env.BUILD_TARGET = LEGACY | MODERN
Example:
config/targets.js
const browsers = [
'last 1 Chrome versions'
];
const isFallback = process.env.BUILD_TARGET === 'LEGACY';
if (isFallback) {
browsers.push('ie 11');
}
module.exports = {
browsers
};
run:
ember build:fallback --prod
check index.html
dist/index.html
before:
<body>
<script src="/assets/vendor.js"></script>
<script src="/assets/dummy.js"></script>
</body>
after:
<body>
<script src="/assets/vendor.js" type="module"></script>
<script src="/assets/dummy.js" type="module"></script>
<script src="/assets/vendor.fb.js" nomodule></script>
<script src="/assets/dummy.fb.js" nomodule></script>
</body>
new files: vendor.fb.js
, dummy.fb.js
- legacy js bundles (for older browsers)
modern browser will load script[type="module"]
, older - script[nomodule]
done!
See the Contributing guide for details.
This project is licensed under the MIT License.