alloc / cush

WIP module bundler 🎁
MIT License
0 stars 0 forks source link

Module aliasing #13

Open aleclarson opened 6 years ago

aleclarson commented 6 years ago

Add this.alias() to cush.config.js which provides support for "shortcuts" to any module (or directory) in the project.

this.alias({
  'foo': './src/components', // alias to relative path
  'bar': '@foo/bar',         // alias to node_modules package
});

// inside "src/pages/foo.js"
require('foo') // same as: require('../src/components')
require('bar') // same as: require('@foo/bar')

Aliases take precedence over everything.