rocjs / roc

🐦 Modern JavaScript Development Ecosystem
MIT License
425 stars 23 forks source link

webpack.config exporter #162

Open sigsegvat opened 7 years ago

sigsegvat commented 7 years ago

hi! I tried roc and it realy looks nice. Is there any way to get the webpack.config the project is effectively using?

something like roc webpack > webpack.config.js would be nice.

thanks!

dlmr commented 7 years ago

Hello!

We are planing to make this easier in the future, part of the documentation generation, but there is a solution right not that you can use.

// roc.config.js

module.exports = {
  project: {
    actions: [{
      hook: 'build-webpack',
      action: () => () => (webpackConfig) => {
        // Logs the Webpack configuration before the roc.config.webpack is applied.
        // If we want the configuration with the roc.config.webpack applied we need to do 
        // a little more work.
        console.log(JSON.stringify(webpackConfig, null, 2));
        return webpackConfig;
      }
    }]
  }
};