diff --git a/config/webpack/webpack.config.js b/config/webpack/webpack.config.js index 4904c08..b3a1461 100644 --- a/config/webpack/webpack.config.js +++ b/config/webpack/webpack.config.js @@ -1,16 +1,19 @@ const path = require("path") const webpack = require("webpack") const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production'; module.exports = { - mode: "production", - devtool: "source-map", + mode, entry: { application: [ "./app/javascript/application.js", './app/assets/stylesheets/application.css', ], }, + optimization: { + moduleIds: 'deterministic', + }, output: { filename: "[name].js", chunkFilename: "[name]-[contenthash].digested.js", @@ -31,8 +34,11 @@ module.exports = { use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'], }, { - test: /\.(png|jpe?g|gif|eot|woff2|woff|ttf|svg)$/i, - use: 'file-loader', + test: /\.(png|jpe?g|svg)$/i, + loader: 'file-loader', + options: { + name: '[name].[ext]', + }, }, ], },