Sha256: 4ff8422eff9630be39d0d2b9e33671765d3d6d2d607af01620b2f595efc3d188

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

var path = require("path");
var webpack = require("webpack");
var AssetsPlugin = require("assets-webpack-plugin");
var CompressionPlugin = require("compression-webpack-plugin");

var development = !process.env.RAILS_ENV || process.env.RAILS_ENV === "development";

var config = {
  entry: {
    application: "application"
  },
  output: {
    path: path.join(__dirname, "public", "webpack"),
    filename: development ? "[name].js" : "[name]-[hash].js",
    publicPath: development ? "http://localhost:8080/" : "/webpack/",
  },
  module: {
    loaders: [
      {test: /\.css$/, loader: "style-loader!css-loader"},
      {test: /\.scss$/, loader: "style-loader!css-loader!sass-loader"},
      {test: /\.jsx?$|\.tag$/, exclude: /node_modules/, loader: "react-hot!babel-loader?cacheDirectory&presets[]=es2015&presets[]=react&plugins[]=react-require"},
      {test: /\.coffee$/, loader: "coffee-loader"},
      {test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/, loader: "file"}
    ]
  },
  plugins: [
    new webpack.DefinePlugin({
      "process.env": JSON.stringify({
        NODE_ENV: process.env.RAILS_ENV
      })
    }),
    new AssetsPlugin({path: path.join(__dirname)})
  ],
  resolve: {
    root: [
      path.join(__dirname, "app", "webpack", "javascripts"),
      path.join(__dirname, "app", "webpack", "stylesheets"),
      path.join(__dirname, "app", "webpack", "images")
    ],
    extensions: ["", ".js", ".jsx", ".coffee"]
  },
  sassLoader: {
    includePaths: [
      path.join(__dirname, "node_modules")
    ]
  }
};

if (development) {
  config.devtool = "#eval-cheap-module-inline-source-map";
} else {
  config.plugins.push(
    new webpack.optimize.UglifyJsPlugin({sourceMap: false, compress: {warnings: false}}),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new CompressionPlugin()
  );
  config.bail = true;
}

module.exports = config;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frontrunner-0.1.0 lib/generators/frontrunner/templates/webpack.config.js