README
bit-loader-shimmer
plugin for shimming modules in bit-bundler.
Install
$ npm install @bit/loader-shimmer
Options
path
String for defining the path where the file is located.
shim({
boostrap: {
path: './node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
}
})
name
As an alternative to path, you can specify module names which go through the same process of module name resolution as any other module.
shim({
boostrap: {
name: 'bootstrap-sass/assets/javascripts/bootstrap',
}
})
imports
Configuration for defining dependencies. You can provide a module name, an array of them, or configuration objects for richer definitions. With objects you can define import aliases as well as globals.
When defining a configuration object with a module name as well as a global name, the module name is imported and also written to the global object.
The following example does a few things.
- Defines the specific file to be used when the module
bootstrapis imported by another module. - It defines a dependency on
jquery, which causesjqueryto be laoded first and brought in as a dependency. - It creates a local variable called
jQuerywhich points tojquery.
shim({
boostrap: {
path: './node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
imports: [{
as: 'jQuery',
name: 'jquery'
}]
}
})
// The result is something like:
// jQuery = require('jquery');
You can also just import something from the global object.
shim({
boostrap: {
path: './node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
imports: [{
as: 'jQuery',
global: '