Skip to content

Optionally require es6-promise and isomorphic-fetch #369

@moretti

Description

@moretti

It would be nice if we could optionally avoid to polyfill Promise and window.fetch.
The latest versions of Firefox, Chrome and Opera natively support Promises and window.fetch, so it seems unnecessary. I recently started loading polyfills on demand with webpack in order to reduce the size of the main bundle.

I'm proposing the following structure

  • marty.js (or maybe marty-without-polyfills.js): equivalent to the current file, but without polyfills
  • polyfills.js: a file containing all polyfills
  • index.js (or maybe marty-with-polyfills.js): the entry point of the project with the old behavior

In this way it would be possible not to load polyfills by creating an alias.
With webpack:

module.exports = {
  // ...
  resolve: {
    alias: {
      'marty': 'marty/marty-without-polyfills.js'
    }
  }
};

With browserify:

browserify --require marty:marty/marty-without-polyfills.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions