Sha256: 7ca46ceed9d42c77f9a491c171b4a07a773661db186fc2a1903d6c8261553353

Contents?: true

Size: 1.78 KB

Versions: 6

Compression:

Stored size: 1.78 KB

Contents

const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = (env) => {
  var config = {
    entry: path.resolve(__dirname, 'web', 'src', 'index.js'),
    output: {
      filename: 'bundle.js',
      path: path.resolve(__dirname, "builds", "web", env)
    },
    resolve: {
      alias: {
        driver: path.join(__dirname, 'web', 'src', 'driver', env)
      }
    },
    plugins: [
        new CopyWebpackPlugin([
            {
                from: path.resolve(__dirname, 'web', 'public')
            },
        ])
    ],
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
            },
            {
              test: /\.(png|jp(e*)g|svg)$/,  
              use: [{
                  loader: 'url-loader',
                  options: { 
                      limit: 8000, // Convert images < 8kb to base64 strings
                      name: 'images/[hash]-[name].[ext]'
                  } 
              }]
            },
            {
                test: /\.jsx?/,
                include: path.resolve(__dirname, 'web'),
                use: 'babel-loader'
            }
        ]
    }
  }

  if (env == 'production') {
    config.module.rules.push(
      {
        // opal-webpack-bundler will compile and include ruby files in the pack
        test: /\.rb$/,
        use: [
          {
            loader: 'opal-webpack-bundler',
            options: {
              useBundler: true,
              paths: [path.resolve(__dirname), path.resolve(__dirname, 'lib')],
              sourceMap: false,
              root: path.resolve(__dirname)
            }
          }
        ]
      }
    );
  }

  return config;
};

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gamefic-sdk-2.2.0 scaffolds/react/webpack.config.js
gamefic-sdk-2.1.0 scaffolds/react/webpack.config.js
gamefic-sdk-2.0.4 scaffolds/react/webpack.config.js
gamefic-sdk-2.0.3 scaffolds/react/webpack.config.js
gamefic-sdk-2.0.2 scaffolds/react/webpack.config.js
gamefic-sdk-2.0.1 scaffolds/react/webpack.config.js