babel-plugin-cortex-module

1.0.0-beta.2 • Public • Published

babel-plugin-cortex-module

babel plugin for import cortex module

Usage

Install

Install the plugin

npm i babel-plugin-cortex-module

Configuration

Define plugin in webpack.config.js and add neurons/ as resolve path:

module.exports = {
    module: {
        loaders: [{
            test: /\.jsx?$/,
            loader: 'babel',
            exclude: /node_modules/,  // Don't exclude 'neurons' here
            query: {
                presets: ['react', 'es2015'],
                plugins: ["cortex-module"]  // Define plugin here
            }
        }
    },
    resolve: {
        modulesDirectories: ["node_modules", "neurons"]  // Add 'neurons' here
    }
}

Module Usage

Add @cortex prefix to module name in your file:

var $ = require('@cortex/zepto');
 
// es2015 syntax also supported
import $ from '@cortex/zepto';
 
// requiring specific files
var something = require('@cortex/some-module/src/something');

Build

Run cortex install and then webpack directly.

#!/usr/bin/env bash 
cortex install
webpack

Package Sidebar

Install

npm i babel-plugin-cortex-module

Weekly Downloads

1

Version

1.0.0-beta.2

License

MPL-2.0

Last publish

Collaborators

  • rhgb