Closed aleclarson closed 6 years ago
The initial implementation is in place (see here).
The plugins themselves are included in the core, but their heavy dependencies are installed on-demand (when a bundled package needs the plugin).
This can be used by third-party plugins like so:
import {lazyRequire} from 'cara/utils'
import {Plugin} from 'cara'
class MyPlugin extends Plugin {
async load() {
this._transform = await lazyRequire('my-transformer')
}
transform(module) {
return this._transform(module.read())
}
}
Include plugin detection within
src/plugins/*.js
files, paired with which NPM package should be installed (global cache?) when a bundle needs the plugin.Right now, the Babel, TypeScript, and SASS plugins are installed automatically, which is not ideal.