sarsamurmu / reboost

A super fast dev server for rapid web development
MIT License
61 stars 3 forks source link

"Extends" property #20

Open GHNewbiee opened 4 years ago

GHNewbiee commented 4 years ago

I suggest the use of extends: string<path_to_foreign_config_file> property in options which are related to foreign packages configuration. In this manner, the reboost's own options are kept separate from the foreign ones.

For example, in contentServer, resolve, chokidar, PostCSSPlugin, esbuildPlugin, BabelPlugin, etc.

There are people who like having a main config file, like windows "registry", and others who prefer working with many small config files. Just give them the freedom to choose and keep them satisfied.

sarsamurmu commented 4 years ago

I always thought that they can do it using Node JS modules. For example

// resolve.config.js
module.exports = {
  // Resolve options
}

// babel.config.json
{
  "plugins": ["some-plugin"]
}

// reboost.js
const { start } = require('reboost');
const BabelPlugin = require('@reboost/plugin-babel');
const resolveConfig = require('./resolve.config.js');
const babelConfig = require('./babel.config.json');

start({
  resolve: {
    ...resolveConfig,
    // If I want to override `extensions` option
    extensions: myExtensions
  },
  plugins: [
    BabelPlugin(babelConfig)
  ]
})

So do we really need that option?

GHNewbiee commented 4 years ago

You are absolutely right! We do not really need it! You may keep it as a low priority sugar syntax for the spread operator in future when all other high priorities will have been settled down and you'll wonder what else small features can be added to "improve/develop" the project. I have seen that "extends" property is often used by other packages, too.

sarsamurmu commented 4 years ago

Yeah, you are right! Leaving this issue open.