We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const CleanWebpackPlugin = require("clean-webpack-plugin"); module.exports = { mode: "production", entry: { app: "./src/index.js" }, devtool: "inline-source-map", devServer: { contentBase: "./dist", hot: true }, output: { path: path.resolve(__dirname, "dist"), filename: "[name].bundle.js" }, module: { rules: [ { test: /\.css$/, use: ["style-loader", "css-loader"] }, { test: /\.(png|svg|jpg|gif)$/, use: ["file-loader"] } ] }, plugins: [ new CleanWebpackPlugin(["dist"]), new HtmlWebpackPlugin({ title: "Production" }) ] };
use webpack-merge get dev and prod config
const merge = require("webpack-merge"); const common = require("./webpack.common.js"); const webpack = require("webpack"); module.exports = merge(common, { devtool: "inline-source-map", devServer: { contentBase: "./dist", hot: true }, plugins: [ new webpack.NamedModulesPlugin(), new webpack.HotModuleReplacementPlugin(), new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("development") }) ] });
const merge = require("webpack-merge"); const UglifyJSPlugin = require("uglifyjs-webpack-plugin"); const common = require("./webpack.common.js"); const webpack = require("webpack"); module.exports = merge(common, { devtool: "source-map", plugins: [ new UglifyJSPlugin({ sourceMap: true }), new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("production") }) ] });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
webpack4 config-5
webpack-merge
use webpack-merge get dev and prod config
The text was updated successfully, but these errors were encountered: