github.com/mayra-cabrera/buffalo@v0.9.4-0.20170814145312-66d2e7772f11/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 new webpack.LoaderOptionsPlugin({ 31 minimize: true, 32 debug: false 33 }), 34 new webpack.optimize.UglifyJsPlugin({ 35 beautify: false, 36 mangle: { 37 screw_ie8: true, 38 keep_fnames: true 39 }, 40 compress: { 41 screw_ie8: true 42 }, 43 comments: false 44 }) 45 ], 46 module: { 47 rules: [{ 48 test: /\.jsx?$/, 49 loader: "babel-loader", 50 exclude: /node_modules/ 51 }, { 52 test: /\.scss$/, 53 use: ExtractTextPlugin.extract({ 54 fallback: "style-loader", 55 use: 56 [{ 57 loader: "css-loader", 58 options: { sourceMap: true } 59 }, 60 { 61 loader: "sass-loader", 62 options: { sourceMap: true } 63 }] 64 }) 65 }, { 66 test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, 67 use: "url-loader?limit=10000&mimetype=application/font-woff" 68 }, { 69 test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, 70 use: "url-loader?limit=10000&mimetype=application/font-woff" 71 }, { 72 test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, 73 use: "url-loader?limit=10000&mimetype=application/octet-stream" 74 }, { 75 test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, 76 use: "file-loader" 77 }, { 78 test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, 79 use: "url-loader?limit=10000&mimetype=image/svg+xml" 80 }, { 81 test: require.resolve('jquery'), 82 use: 'expose-loader?jQuery!expose-loader?$' 83 }] 84 } 85 };