Sha256: bda3235a407d20f58910005b54748b08d49c0b380267465273df91fd2bfa7757

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

<%= add_documentation_reference(config[:message], "// https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/blob/master/config/webpack/webpackConfig.js") %>

const clientWebpackConfig = require('./clientWebpackConfig');
const serverWebpackConfig = require('./serverWebpackConfig');

const webpackConfig = (envSpecific) => {
  const clientConfig = clientWebpackConfig();
  const serverConfig = serverWebpackConfig();

  if (envSpecific) {
    envSpecific(clientConfig, serverConfig);
  }

  let result;
  // For HMR, need to separate the the client and server webpack configurations
  if (process.env.WEBPACK_SERVE || process.env.CLIENT_BUNDLE_ONLY) {
    // eslint-disable-next-line no-console
    console.log('[React on Rails] Creating only the client bundles.');
    result = clientConfig;
  } else if (process.env.SERVER_BUNDLE_ONLY) {
    // eslint-disable-next-line no-console
    console.log('[React on Rails] Creating only the server bundle.');
    result = serverConfig;
  } else {
    // default is the standard client and server build
    // eslint-disable-next-line no-console
    console.log('[React on Rails] Creating both client and server bundles.');
    result = [clientConfig, serverConfig];
  }

  // To debug, uncomment next line and inspect "result"
  // debugger
  return result;
};

module.exports = webpackConfig;

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
react_on_rails-13.0.0 lib/generators/react_on_rails/templates/base/base/config/webpack/webpackConfig.js.tt
react_on_rails-13.0.0.beta.0 lib/generators/react_on_rails/templates/base/base/config/webpack/webpackConfig.js.tt
react_on_rails-12.6.0 lib/generators/react_on_rails/templates/base/base/config/webpack/webpackConfig.js.tt
react_on_rails-12.5.2 lib/generators/react_on_rails/templates/base/base/config/webpack/webpackConfig.js.tt
react_on_rails-12.5.1 lib/generators/react_on_rails/templates/base/base/config/webpack/webpackConfig.js.tt
react_on_rails-12.5.0 lib/generators/react_on_rails/templates/base/base/config/webpack/webpackConfig.js.tt