Coder Social home page Coder Social logo

eco's Introduction

Ololo

library is consumed by spa_modern.

Let's try to setup all es6 features including modules.

npm run setup

spa_modern has a bundle configuration via Webpack with Babel transformation

  loader: 'babel-loader',
  include: [
    path.resolve(BASE_PATH, 'src'),
    // This module is published as ES2015 and must be transpiled
    path.resolve(BASE_PATH, 'node_modules/library'),
    path.resolve(BASE_PATH, '../library') // for local npm linked package

In order to have polyfills, it includes also

+  entry: ['babel-polyfill', './src/index.js'],
-  entry: ['./src/index.js'],

And additional setup for Babel

  ["env", {
+    "useBuiltIns": true,

The problem though is that there are too many polyfills.

Once we need polyfill for library code, we already have it on SPA level.

Let's consider the second possible way of library using โ€” as a prepared script. Rollup with proper plugins can assemble bundled version of the library with all polyfills for chossen browsers in the babel-env-plugin config. You can change this list of browsers and get an updated build file.

babel-env-plugin will have ability of choosing polyfills in use later along with Babel7. see discussion on GitHub Experimental settings are in babel7 branch.

Uglify doesn't remove unused polyfills.

Next actions possible:

  • create framework-agnostic library with static code analysis, which append polyfills based on used features
  • wait until Babel7 family is production ready; could happen before Christmas
  • make env-plugin better for Babel6

eco's People

Contributors

ivn-cote avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.