So, I have a directory
mods/
-core/
--index.js
--scripts/
---lots of stuff imported by core/index
This works with typical rollup fashion if you want to export to for example mods/core/index.min.js
But I have many of these mods/**/ directories and I want to take advantage of the fact that they are rollup'd into iifes. Each mods/**/index.js will, rather than export, assign to a global variable that we presume is provided:
core/index.js
import ui from './scripts/ui/
global.ui = ui
someMod/scripts/moddedClass.js
export default class moddedClass extends global.ui.something { /* some functionality extension */}
someMod/index.js
import moddedClass from './scripts/moddedClass'
global.ui.something = moddedClass;
So hopefully you can see how each mod directory can be rollup'd in typical fashion but, I need to then put the actual iifes inside another one so that:
mods/compiled.js
(function compiled() {
const global = {};
(function core() {
//typical rollup iife
})();
(function someMod() {
//typical rollup iife
})();
//a footer like return global or global.init()
})();
Any help towards this end would be greatly appreciated. The simplest possible answer, I think, is how I can simply get a string value for each mod's iife instead of rollup writing it to a file. At that point I could just iterate the /mods/ directory, call rollup on each index, and build the outer iife myself.
via Danie Clawson
No comments:
Post a Comment