laravel-elixir-system
Laravel Elixir extension to transform ES6 modules to System. Inspired by flarum-gulp.
ES6 System Loader Polyfills: SystemJS, ES6 Module Loader or ES6 Micro Loader
Installation
npm install --save-dev laravel-elixir-system
Usage
mix.system(modules, output, baseDir, options)
modules
- A map of module prefixes to their source files.output
- The resulting file to write to. Defaults topublic/js/bundle.js
.baseDir
- The base directory of the source files. Defaults toresources/assets/js
.options
- An object of options:includeHelpers
- Include Babel helpers. Default:false
.
Example
Let's say you have an app with some modules for the main component, some for the admin and some that are shared:
.
├── app
| ├── App.js
| └── ModuleA.js
├── admin
| ├── App.js
| └── ModuleB.js
└── lib
└── ModuleC.js
var elixir = ; ; ;
Then using the one of the polyfills:
var App = Systemdefault;var ModuleA = Systemdefault;var ModuleC = Systemdefault; var app = ;var mA = ;var mC = ;
See the example directory for a complete example.