Sha256: c41f2d5bf2ecec676cd4c7be6bce33f53a81f2d04bb1c0512205d88732e4f925

Contents?: true

Size: 972 Bytes

Versions: 20

Compression:

Stored size: 972 Bytes

Contents

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

module.exports = function (api) {
  const defaultConfigFunc = require('shakapacker/package/babel/preset.js')
  const resultConfig = defaultConfigFunc(api)
  const isProductionEnv = api.env('production')

  const changesOnDefault = {
    presets: [
      [
        '@babel/preset-react',
        {
          development: !isProductionEnv,
          useBuiltIns: true
        }
      ]
    ].filter(Boolean),
    plugins: [
      process.env.WEBPACK_SERVE && 'react-refresh/babel',
      isProductionEnv && ['babel-plugin-transform-react-remove-prop-types',
        {
          removeImport: true
        }
      ]
    ].filter(Boolean),
  }

  resultConfig.presets = [...resultConfig.presets, ...changesOnDefault.presets]
  resultConfig.plugins = [...resultConfig.plugins, ...changesOnDefault.plugins ]

  return resultConfig
}

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
react_on_rails-14.1.1 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-14.1.0 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-14.1.0.rc.0 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-15.0.0.alpha.1 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-14.0.5 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-14.0.4 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-14.0.3 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-14.0.2 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-14.0.0 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.4.0 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.3.5 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.3.4 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.3.3 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.3.2 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.3.1 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.3.0 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.2.0 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.1.0 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.0.2 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt
react_on_rails-13.0.1 lib/generators/react_on_rails/templates/base/base/babel.config.js.tt