github.com/bketelsen/buffalo@v0.9.5/generators/assets/webpack/templates/webpack.config.js.tmpl (about)

     1  var webpack = require("webpack");
     2  var CopyWebpackPlugin = require('copy-webpack-plugin');
     3  var ExtractTextPlugin = require("extract-text-webpack-plugin");
     4  var ManifestPlugin = require('webpack-manifest-plugin');
     5  
     6  module.exports = {
     7    entry: {
     8      application: [
     9        "./assets/js/application.js",
    10        "./node_modules/jquery-ujs/src/rails.js",
    11        "./assets/css/application.scss"
    12      ]
    13    },
    14    output: {
    15      filename: "[name].[hash].js",
    16      path: __dirname + "/public/assets"
    17    },
    18    plugins: [
    19      new webpack.ProvidePlugin({
    20        $: "jquery",
    21        jQuery: "jquery"
    22      }),
    23      new ExtractTextPlugin("[name].[hash].css"),
    24      new CopyWebpackPlugin([{
    25        from: "./assets",
    26        to: ""
    27      }], {
    28        ignore: [
    29          "css/*",
    30          "js/*",
    31        ]
    32      }),
    33      new webpack.LoaderOptionsPlugin({
    34        minimize: true,
    35        debug: false
    36      }),
    37      new webpack.optimize.UglifyJsPlugin({
    38        beautify: false,
    39        mangle: {
    40          screw_ie8: true,
    41          keep_fnames: true
    42        },
    43        compress: {
    44          screw_ie8: true
    45        },
    46        comments: false
    47      }),
    48      new ManifestPlugin({
    49        fileName: "manifest.json",
    50      })
    51    ],
    52    module: {
    53      rules: [{
    54        test: /\.jsx?$/,
    55        loader: "babel-loader",
    56        exclude: /node_modules/
    57      }, {
    58        test: /\.scss$/,
    59        use: ExtractTextPlugin.extract({
    60          fallback: "style-loader",
    61          use:
    62          [{
    63            loader: "css-loader",
    64            options: { sourceMap: true }
    65        	},
    66          {
    67            loader: "sass-loader",
    68            options: { sourceMap: true }
    69          }]
    70        })
    71      }, {
    72        test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
    73        use: "url-loader?limit=10000&mimetype=application/font-woff"
    74      }, {
    75        test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
    76        use: "url-loader?limit=10000&mimetype=application/font-woff"
    77      }, {
    78        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
    79        use: "url-loader?limit=10000&mimetype=application/octet-stream"
    80      }, {
    81        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
    82        use: "file-loader"
    83      }, {
    84        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
    85        use: "url-loader?limit=10000&mimetype=image/svg+xml"
    86      }, {
    87        test: require.resolve('jquery'),
    88        use: 'expose-loader?jQuery!expose-loader?$'
    89      }]
    90    }
    91  };