Sha256: 92c6d4c90fe2e211ffbd3e2190d0b1c131327ce6178ac836f5fedd94f65ad547

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 KB

Contents

const webpack = require('webpack');
const path = require('path');

const devBuild = process.env.NODE_ENV !== 'production';
const nodeEnv = devBuild ? 'development' : 'production';

const config = {
  entry: [
    'es5-shim/es5-shim',
    'es5-shim/es5-sham',
    'babel-polyfill',
    './app/bundles/HelloWorld/startup/HelloWorldApp',
  ],

  output: {
    filename: 'webpack-bundle.js',
    path: '../app/assets/webpack',
  },

  resolve: {
    extensions: ['', '.js', '.jsx'],
    alias: {
      react: path.resolve('./node_modules/react'),
      'react-dom': path.resolve('./node_modules/react-dom'),
    },
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify(nodeEnv),
      },
    }),
  ],
  module: {
    loaders: [
      {
        test: require.resolve('react'),
        loader: 'imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham',
      },
      {
        test: /\.jsx?$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
      },
    ],
  },
};

module.exports = config;

if (devBuild) {
  console.log('Webpack dev build for Rails'); // eslint-disable-line no-console
  module.exports.devtool = 'eval-source-map';
} else {
  config.plugins.push(
    new webpack.optimize.DedupePlugin()
  );
  console.log('Webpack production build for Rails'); // eslint-disable-line no-console
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
react_on_rails-6.2.1 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.2.1.rc.3 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.2.1.rc.2 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.2.1.rc.1 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.2.0 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.1.2 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.1.1 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.1.1.rc.1 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
react_on_rails-6.1.0 lib/generators/react_on_rails/templates/base/base/client/webpack.config.js