github.com/jasonish/buffalo@v0.8.2-0.20170413145823-bacbdd415f1b/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        options: {
    36          presets: ['env']
    37        },
    38        exclude: /node_modules/
    39      }, {
    40        test: /\.scss$/,
    41        use: ExtractTextPlugin.extract({
    42          fallback: "style-loader",
    43          use:
    44          [{
    45            loader: "css-loader",
    46            options: { sourceMap: true }
    47        	},
    48          {
    49            loader: "sass-loader",
    50            options: { sourceMap: true }
    51          }]
    52        })
    53      }, {
    54        test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
    55        use: "url-loader?limit=10000&mimetype=application/font-woff"
    56      }, {
    57        test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
    58        use: "url-loader?limit=10000&mimetype=application/font-woff"
    59      }, {
    60        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
    61        use: "url-loader?limit=10000&mimetype=application/octet-stream"
    62      }, {
    63        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
    64        use: "file-loader"
    65      }, {
    66        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
    67        use: "url-loader?limit=10000&mimetype=image/svg+xml"
    68      }, {
    69        test: require.resolve('jquery'),
    70        use: 'expose-loader?jQuery!expose-loader?$'
    71      }]
    72    }
    73  };