Sha256: 22dc341f18fb2cb2b34c244c85268dfc06541234e6c7ce2c4a65c6d6d9011b58

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

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

13 entries across 13 versions & 1 rubygems

Version Path
shakapacker-7.2.3 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.3.0.beta.1 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.2.2 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.2.1 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.2.0 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.2.0.rc.0 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.1.0 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.0.3 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.0.2 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.0.1 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.0.0 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.0.0.rc.2 spec/dummy/config/webpack/ServerClientOrBoth.js
shakapacker-7.0.0.rc.1 spec/dummy/config/webpack/ServerClientOrBoth.js