PHP Classes

File: webpack.config.js

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Cool Kids Network For WP Plugin   webpack.config.js   Download  
File: webpack.config.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Cool Kids Network For WP Plugin
WordPress plugin to manage users with roles
Author: By
Last change:
Date: 28 days ago
Size: 1,742 bytes
 

Contents

Class file image Download
const path = require("path"); const TerserPlugin = require("terser-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const defaultConfig = require("@wordpress/scripts/config/webpack.config"); module.exports = { ...defaultConfig, entry: { coolkidsnetwork: "./src/main.jsx", }, output: { path: path.resolve(__dirname, "assets/js"), filename: "[name].min.js", publicPath: "../../", assetModuleFilename: "images/[name][ext][query]", }, resolve: { extensions: [".js", ".jsx"], }, module: { ...defaultConfig.module, rules: [ //...defaultConfig.module.rules, { test: /\.(js|jsx)$/, exclude: /node_modules/, use: "babel-loader", }, { test: /\.(css|scss)$/, exclude: /node_modules/, use: [ "style-loader", { loader: MiniCssExtractPlugin.loader, options: { esModule: false, }, }, { loader: "css-loader", }, "sass-loader", ], }, { test: /\.svg/, type: "asset/inline", }, { test: /\.(png|jpg|gif)$/, type: "asset/resource", generator: { filename: "../images/[name][ext][query]", }, }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", generator: { filename: "../fonts/[name][ext][query]", }, }, ], }, plugins: [ ...defaultConfig.plugins, new CleanWebpackPlugin(), new MiniCssExtractPlugin({ filename: "../css/[name].min.css", }), ], optimization: { minimize: true, minimizer: [ new TerserPlugin({ terserOptions: { format: { comments: false, }, }, extractComments: false, }), ], }, };