New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

requirejs-es2015

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requirejs-es2015

RequireJS plugin to load ES2015 modules via babel.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-50%
Maintainers
2
Weekly downloads
 
Created
Source

requirejs-es2015

A RequireJS plugin to load ECMAScript 2015 modules via babel. It depends on babel-core 6.x and comes with the ES2015 preset as well as babel plugin for transforming ES2015 modules to AMD.

For transforming advanced ECMAScript syntax, it uses your projects .babelrc, so you can choose, which presets and plugins you want to use.

Table of contents

Features

  • Transpile ES2015 modules to AMD RequireJS modules and load them via es! prefix
  • ESNext support using your very own .babelrc or babel-config from your package.json

Installation

Install the package either by using npm or yarn.

npm i -D requirejs-es2015
yarn add -D requirejs-es2015

Usage

To make use of the plugin, you want to modify your RequireJS config file, to contain the path to the requirejs-es2015 package as well as an optional file extension that is used by your ES2015 files.

It should look something like this:

requirejs.config({
    // ...
    paths: {
        es: 'node_modules/requirejs-es2015/es'
    },
    babel: {
        fileExtension: '.js' // extension of your ES2015 files - defaults to .js
    }
    // ...
});

You can now import ES2015 modules in your RequireJS files like this:

define([
    'es!myModule',
    'es!components/anotherModule'
], function(myModule, anotherModule) {
    myModule.method();
    anotherModule.test();
});

If you want to use babel-transformations besides the built-in ES2015 preset, you can create a .babelrc in your projects root directory (if not already present) or use the babel section of your package.json file.

Todo

  • Add examples
  • Add module exports for export default syntax

License

MIT

FAQs

Package last updated on 07 Sep 2017

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