Skip to content

Instantly share code, notes, and snippets.

@rauschma
Last active April 8, 2018 02:25
Show Gist options
  • Select an option

  • Save rauschma/fc6973110700c4932d360d5eb6ad9931 to your computer and use it in GitHub Desktop.

Select an option

Save rauschma/fc6973110700c4932d360d5eb6ad9931 to your computer and use it in GitHub Desktop.

Revisions

  1. rauschma revised this gist Jul 25, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion preset-env-usebuiltins.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Polyfillying the standard library when using `babel-preset-env`

    * General sketch of a workflow based on `env`: http://2ality.com/2017/07/npm-packages-via-babel.html
    * Overview of a workflow based on `env`: http://2ality.com/2017/07/npm-packages-via-babel.html
    * `env` has the option `useBuiltins` that helps with polyfilling the standard library: https://github.com/babel/babel-preset-env#usebuiltins

    ## Browsers
  2. rauschma revised this gist Jul 25, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions preset-env-usebuiltins.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    # Polyfillying when using `babel-preset-env`
    # Polyfillying the standard library when using `babel-preset-env`

    General sketch of a workflow based on `env`: http://2ality.com/2017/07/npm-packages-via-babel.html
    * General sketch of a workflow based on `env`: http://2ality.com/2017/07/npm-packages-via-babel.html
    * `env` has the option `useBuiltins` that helps with polyfilling the standard library: https://github.com/babel/babel-preset-env#usebuiltins

    ## Browsers

  3. rauschma revised this gist Jul 25, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion preset-env-usebuiltins.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ General sketch of a workflow based on `env`: http://2ality.com/2017/07/npm-packa

    ## Browsers

    Approach for untranspiled code:
    Approach for untranspiled code (meant to be transpiled by Babel and, e.g., webpack):

    * No package ever polyfills.
    * Use only functionality at stage 4 or older.
  4. rauschma revised this gist Jul 25, 2017. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions preset-env-usebuiltins.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,8 @@
    # Browsers
    # Polyfillying when using `babel-preset-env`

    General sketch of a workflow based on `env`: http://2ality.com/2017/07/npm-packages-via-babel.html

    ## Browsers

    Approach for untranspiled code:

    @@ -7,7 +11,7 @@ Approach for untranspiled code:
    * The entry point does `import "babel-polyfill";` for which `env.useBuiltins` generates the imports appropriate for the current targets.
    * Benefit: the bundle only includes functionality that the target platforms don’t have. Think: custom-tailored `babel-polyfill`.

    # Node.js
    ## Node.js

    For Node.js, the untranspiled code would be transpiled via `target: { node: "current" }`.

  5. rauschma revised this gist Jul 25, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion preset-env-usebuiltins.md
    Original file line number Diff line number Diff line change
    @@ -11,5 +11,5 @@ Approach for untranspiled code:

    For Node.js, the untranspiled code would be transpiled via `target: { node: "current" }`.

    * Play it safe, should every package do `import "babel-polyfill";` at its entry point?
    * To play it safe, should every package do `import "babel-polyfill";` at its entry point?
    * Note: not as problematic, because bundle size is not a factor on Node.js.
  6. rauschma revised this gist Jul 25, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions preset-env-usebuiltins.md
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@

    Approach for untranspiled code:

    * No package ever polyfills
    * Use only functionality from stage 4 or older
    * No package ever polyfills.
    * Use only functionality at stage 4 or older.
    * The entry point does `import "babel-polyfill";` for which `env.useBuiltins` generates the imports appropriate for the current targets.
    * Benefit: the bundle only includes functionality that the target platforms don’t have. Think: custom-tailored `babel-polyfill`.

  7. rauschma created this gist Jul 25, 2017.
    15 changes: 15 additions & 0 deletions preset-env-usebuiltins.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # Browsers

    Approach for untranspiled code:

    * No package ever polyfills
    * Use only functionality from stage 4 or older
    * The entry point does `import "babel-polyfill";` for which `env.useBuiltins` generates the imports appropriate for the current targets.
    * Benefit: the bundle only includes functionality that the target platforms don’t have. Think: custom-tailored `babel-polyfill`.

    # Node.js

    For Node.js, the untranspiled code would be transpiled via `target: { node: "current" }`.

    * Play it safe, should every package do `import "babel-polyfill";` at its entry point?
    * Note: not as problematic, because bundle size is not a factor on Node.js.