npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

requirejs-es2015

v1.0.2

Published

RequireJS plugin to load ES2015 modules via babel.

Downloads

15

Readme

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