Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-kyt-core

Package Overview
Dependencies
Maintainers
5
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-kyt-core

An opinionated babel preset, best used with kyt

  • 1.0.0-beta.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7K
increased by0.37%
Maintainers
5
Weekly downloads
 
Created
Source

babel-preset-kyt-core

npm

An opinionated Babel preset, best used with kyt. Check out the Options for how to extend polyfill your build targets.

This preset is used as a default if a kyt project does not include a .babelrc It is also included as part of babel-preset-kyt-react

To install:

  1. npm install babel-preset-kyt-core --save
  2. In .babelrc.js:
    module.exports = {
      presets: ['babel-preset-kyt-core'],
    };
    

Options

(see documentation for Babel preset options)

  • envOptions (Object) - extend the default babel-preset-env options. The type of options, client, server, and test, are dependent on the value of process.env.KYT_ENV_TYPE which, when undefined, defaults to client. kyt will automatically set the KYT_ENV_TYPE when it runs commands. For debugging purposes, use "debug": true to see what the plugin is targeting. The following are the default babel-preset-env configurations used by kyt-core:

    • client
      modules: false,
      useBuiltIns: 'entry',
      forceAllTransforms: true,
      targets: {
        browsers: ['>1%', 'last 4 versions', 'not ie < 11'],
      },
      
    • server
      modules: false,
      useBuiltIns: 'entry',
      forceAllTransforms: true,
      targets: {
        node: 'current'
      },
      

    These are sensible defaults that work well with kyt out of the box. The client option, typically reserved for client builds in kyt, is used to target browsers, while the server option targets the current version of node. The client.targets.browsers configuration is in the browserslist format. The following is an example of how to override the option types in your babelrc configuration:

    {
      "presets": [
        [
          "babel-preset-kyt-core", {
            "envOptions": {
              "client": {
                "debug": true,
                "targets": {
                  "browsers": ["last 2 versions"]
                }
              },
              "server": {
                "debug": true,
                "modules": true
              },
            },
          },
        ],
      ],
    }
    

    You can find additional options to configure babel-preset-env here.

  • includeRuntime (Boolean) - whether or not to include babel-plugin-transform-runtime; default: false

Polyfilling

By default babel-preset-env, an internal dependency, is configured to useBuiltIns which means that you can install babel-polyfill as a dependency in your project and import 'babel-polyfill' at the top of your entry file (in a kyt project that would be src/client/index.js and src/server/index.js) to include an optimized polyfill for your build.

Keywords

FAQs

Package last updated on 26 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc