Closed jbanety closed 1 year ago
Hey @jbanety, amazing to see the PR!
So my hope with these workflows was not to enforce a new configuration system, but to rather use the Rollup-native configuration by making the eject being using a rollup configuration file directly as in the workflow like https://jspm.org/docs/integrations#rollup.
Admittedly the problem with this is that we have some custom wrapper logic in the CLI that is lost in making this transition... perhaps if we were to move more of that logic out to the plugin in a way that can be more easily ejected, would that solve your needs here?
Hi @guybedford, I created a PR (#2500) to add custom plugins from a custom script. But you're right it looks like a Rollup config file.
The solution might be to create an other plugin (rollup-jspm-build-plugin
?) to extract the logic into a more modular plugin.
So we can keep the original rollup-jspm-plugin
to resolve package and create a new plugin to handle build process. I don't know.
Or an other solution is to check if a rollup config exists and read this before passing to rollup instance.
Yes I agree we should probably move the logic out of core.
Perhaps this should be its own package like @jspm/builder
that can provide the API that the CLI itself wraps.
jspm does actually expose its API directly - see https://github.com/jspm/jspm-cli/blob/master/src/api.ts.
So that one can do:
const jspm = require('jspm');
await jspm.build(['module-name'], opts);
So the question is perhaps how much to put logic in the plugin vs how much to have logic in jspm itself, which is a tough one. I like having a minimal plugin, but to properly support the "eject" nature of the workflow we should probably move more logic to the plugin.
What is rollup-plugin-jspm
missing for you at the moment in your own workflows? That would help a lot to hear further I think.
Hi @guybedford,
In my workflow, the rollup-plugin-jspm
is, at the moment, able to resolve packages to build bundles with the jspm cli (with import maps).
In my projects, I use web components with css built on the fly from sass during the building.
So I need a way to include rollup plugins to the build process.
I'll work on a proposal for this new plug-in.
Thanks.
Hi @guybedford,
Is there a way to customize Rollup plugins involved in the build process ? The plugins are instanciated at https://github.com/jspm/jspm-cli/blob/master/src/build/index.ts#L113. Maybe an external js function to get an array of custom plugins ? IMO the only way possible today is to recreate the CLI logic in a separate script. Overkill.