github.com/corylanou/buffalo@v0.8.0/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  
     5  module.exports = {
     6    entry: [
     7      "./assets/js/application.js",
     8      "./assets/css/application.scss",
     9      "./node_modules/jquery-ujs/src/rails.js"
    10    ],
    11    output: {
    12      filename: "application.js",
    13      path: __dirname + "/public/assets"
    14    },
    15    plugins: [
    16      new webpack.ProvidePlugin({
    17        $: "jquery",
    18        jQuery: "jquery"
    19      }),
    20      new ExtractTextPlugin("application.css"),
    21      new CopyWebpackPlugin([{
    22        from: "./assets",
    23        to: ""
    24      }], {
    25        ignore: [
    26          "css/*",
    27          "js/*",
    28        ]
    29      })
    30    ],
    31    module: {
    32      rules: [{
    33        test: /\.jsx?$/,
    34        loader: "babel-loader",
    35        exclude: /node_modules/
    36      }, {
    37        test: /\.scss$/,
    38        use: ExtractTextPlugin.extract({
    39          fallback: "style-loader",
    40          use:
    41          [{
    42            loader: "css-loader",
    43            options: { sourceMap: true }
    44        	},
    45          {
    46            loader: "sass-loader",
    47            options: { sourceMap: true }
    48          }]
    49        })
    50      }, {
    51        test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
    52        use: "url-loader?limit=10000&mimetype=application/font-woff"
    53      }, {
    54        test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
    55        use: "url-loader?limit=10000&mimetype=application/font-woff"
    56      }, {
    57        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
    58        use: "url-loader?limit=10000&mimetype=application/octet-stream"
    59      }, {
    60        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
    61        use: "file-loader"
    62      }, {
    63        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
    64        use: "url-loader?limit=10000&mimetype=image/svg+xml"
    65      }, {
    66        test: require.resolve('jquery'),
    67        use: 'expose-loader?jQuery!expose-loader?$'
    68      }]
    69    }
    70  };