Skip to content

A way to serve ES6 bundles to ES6 browsers and serve ES5 to the rest.

Notifications You must be signed in to change notification settings

ehellman/es6-and-legacy-bundle-loading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

es6-and-legacy-bundle-loading

Give window.__APP_CHUNKS__ the paths to your ES6 and legacy bundles/chunks and the script will load the correct bundle by checking if the browser supports <script type="module">.

window.__APP_CHUNKS__ = {
  es: [
    '/main.js',
    '/first.chunk.js',
    '/second.chunk.js'
  ],
  legacy: [
    '/main.legacy.js',
    '/first.legacy.chunk.js',
    '/second.legacy.chunk.js'
  ]
};

About

A way to serve ES6 bundles to ES6 browsers and serve ES5 to the rest.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages