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/,
query: {
presets: ['react', 'es2015'],
plugins: ["cortex-module"]
}
}
},
resolve: {
modulesDirectories: ["node_modules", "neurons"]
}
}
Module Usage
Add @cortex
prefix to module name in your file:
var $ = require('@cortex/zepto');
import $ from '@cortex/zepto';
var something = require('@cortex/some-module/src/something');
Build
Run cortex install
and then webpack directly.
#!/usr/bin/env bash
cortex install
webpack