function myPlugin(lasso, pluginConfig) {
lasso.dependencies.registerRequireExtension(
'foo',
{
getDependencies: function(lassoContext, callback) {
// You can return a Promise/value or invoke the callback
return Promise.resolve([
require.resolve('./extra.js') // Any extra dependencies can be added to this array
]);
},
read: function(path, lassoContext, callback) {
// Read the code for the require dependency
}
});
}
For example: