vtex-home-page/webpack/webpack.prod.js

50 lines
1010 B
JavaScript
Raw Normal View History

2022-12-05 13:22:58 +00:00
const webpack = require("webpack");
const { merge } = require("webpack-merge");
const common = require("./webpack.common.js");
const TerserPlugin = require("terser-webpack-plugin");
const path = require("path");
module.exports = merge(common, {
externals: {
jquery: "jQuery",
vtexjs: "vtexjs",
},
mode: "production",
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules\/(?!(@agenciam3\/pkg)\/).*/,
use: {
loader: "babel-loader",
options: {
presets: [["@babel/preset-env"], "@babel/react"],
plugins: ["@babel/plugin-transform-async-to-generator"],
cacheDirectory: true,
},
},
},
],
},
optimization: {
usedExports: true,
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: true,
terserOptions: {
keep_classnames: true,
keep_fnames: true,
compress: {
pure_funcs: [
"console.table",
"console.debug",
"console.log",
],
},
},
}),
],
},
});