factorial-io / factorial-frontend-stack

Modern frontend tooling with minimal configuration
http://factorial-io.github.io/factorial-frontend-stack/
6 stars 1 forks source link

Refactor core to allow pick and choosing of features #50

Open krisimmig opened 5 years ago

krisimmig commented 5 years ago

While working on the svg-sprite-loader middleware I noticed that when not including the core package, a lot of basic configuration is not happening like the entry points etc. This means that core is a dependency that is always needed and for example the new svg-sprite-loader can not work without it.

My idea is to structure the packages in a way where we have a very basic setup packag, that just configures webpack in terms of source, public folder, entry points etc. Additionally we would have a bunch of packages for CSS conversion, JS conversion, svg-spritemap generation, font loading, image loading, dev-server, (...). Those can then be added to a project as needed.

Thoughts?

mlnmln commented 5 years ago

what exactly is missing when trying to work with svg loader standalone?

neutrino has a default project structure that we should follow. https://neutrinojs.org/project-layout.html

I can imagine creating multiple smaller packages and then creating our own preset. However my last info was that you can only use the official presets from the neutrino org. For now I would prefer to have just one middleware ('core', 'everything', 'younameit') at project level, that consumes the other middlewares.

The whole idea of this project is to have less configuration at project level.

krisimmig commented 5 years ago

I haven't looked at it in detail but I think to make the svg-loader work standalone we need to add this config which is also present in core:

  const publicPath = opts.publicPath || "./";

  // Enable multiple entry points
  const { mains } = neutrino.options;
  Object.keys(mains).forEach(key => {
    neutrino.config.entry(key).add(mains[key]);
  });

  neutrino.config
    .context(neutrino.options.root)
    .output.path(neutrino.options.output)
    .publicPath(options.publicPath)
    .end();

If core is not required in a project, other middleware that doesn't have these settings won't work.