Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including babel-preset-es2015-native-modules with all npm packages installed. Try it out:

var babelPresetEs2015NativeModules = require("babel-preset-es2015-native-modules")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

babel-preset-es2015-native-modules v6.9.4

Babel preset for all es2015 plugins but one, babel-plugin-transform-es2015-modules-commonjs

DEPRECATED NOTICE

This preset is no longer necessary as the function that it performed can now be achieved natively.

Instead of es2015-native-modules please use es2015 with { "modules": false } option:

presets: [
  ["es2015", { "modules": false }]
]

babel-preset-es2015-native-modules

Babel preset for all es2015 plugins MINUS ONE:

  • babel-plugin-transform-es2015-modules-commonjs

Use case

– A preset without transform-es2015-modules-commonjs would help with tree-shaking when using Babel 6 and webpack 2

Tree-shaking with webpack 2 and Babel 6

Install

$ npm install --save-dev babel-preset-es2015-native-modules

Usage

Via .babelrc (Recommended)

.babelrc

{
  "presets": ["es2015-native-modules"]
}

Via CLI

$ babel script.js --presets es2015-native-modules

Via Node API

require("babel-core").transform("code", {
  presets: ["es2015-native-modules"]
});
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free