PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.4.0-beta1
Secure Custom Fields v6.4.0-beta1
6.9.5 6.9.4 6.9.3 6.9.2 6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / webpack.config.js
secure-custom-fields Last commit date
assets 1 year ago includes 1 year ago lang 1 year ago pro 1 year ago README.md 1 year ago acf.php 1 year ago index.php 1 year ago package-lock.json 1 year ago package.json 1 year ago readme.txt 1 year ago webpack.config.js 1 year ago
webpack.config.js
109 lines
1 const path = require('path');
2 const TerserPlugin = require('terser-webpack-plugin');
3 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4 const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
5 const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");
6
7 // Common configuration for both builds
8 const commonConfig = {
9 entry: {
10 // JavaScript files
11 'js/acf-escaped-html-notice': './assets/src/js/acf-escaped-html-notice.js',
12 'js/acf-field-group': './assets/src/js/acf-field-group.js',
13 'js/acf-input': './assets/src/js/acf-input.js',
14 'js/acf-internal-post-type': './assets/src/js/acf-internal-post-type.js',
15 'js/acf': './assets/src/js/acf.js',
16 'js/pro/acf-pro-blocks': './assets/src/js/pro/acf-pro-blocks.js',
17 'js/pro/acf-pro-field-group': './assets/src/js/pro/acf-pro-field-group.js',
18 'js/pro/acf-pro-input': './assets/src/js/pro/acf-pro-input.js',
19 'js/pro/acf-pro-ui-options-page': './assets/src/js/pro/acf-pro-ui-options-page.js',
20
21 // CSS files
22 'css/acf-dark': './assets/src/sass/acf-dark.scss',
23 'css/acf-field-group': './assets/src/sass/acf-field-group.scss',
24 'css/acf-global': './assets/src/sass/acf-global.scss',
25 'css/acf-input': './assets/src/sass/acf-input.scss',
26 'css/pro/acf-pro-field-group': './assets/src/sass/pro/acf-pro-field-group.scss',
27 'css/pro/acf-pro-input': './assets/src/sass/pro/acf-pro-input.scss',
28 },
29 output: {
30 path: path.resolve(__dirname, 'assets/build/'),
31 },
32 module: {
33 rules: [
34 {
35 test: /\.(js|jsx)$/,
36 exclude: /node_modules/,
37 use: {
38 loader: 'babel-loader',
39 },
40 },
41 {
42 test: /\.scss$/,
43 use: [
44 MiniCssExtractPlugin.loader, // Extract CSS into separate files.
45 {
46 loader: 'css-loader',
47 options: {
48 url: false, // Don't resolve URLs.
49 },
50 },
51 'sass-loader',
52 ],
53 }
54 ],
55 },
56 };
57
58 // Unminified build
59 const unminifiedConfig = {
60 ...commonConfig,
61 mode: 'development',
62 output: {
63 ...commonConfig.output,
64 filename: '[name].js', // Unminified output
65 },
66 devtool: 'source-map',
67 optimization: {
68 minimize: false, // No minification for this config
69 },
70 plugins: [
71 new FixStyleOnlyEntriesPlugin(),
72 new MiniCssExtractPlugin({
73 filename: '[name].css', // Output CSS as .css
74 }),
75 ],
76 };
77
78 // Minified build
79 const minifiedConfig = {
80 ...commonConfig,
81 mode: 'production',
82 output: {
83 ...commonConfig.output,
84 filename: '[name].min.js', // Minified output
85 },
86 optimization: {
87 minimize: true, // Enable minification
88 minimizer: [
89 new TerserPlugin({
90 terserOptions: {
91 format: {
92 comments: false, // Remove comments
93 },
94 },
95 extractComments: false,
96 }),
97 new CssMinimizerPlugin(), // Minify CSS
98 ],
99 },
100 plugins: [
101 new FixStyleOnlyEntriesPlugin(),
102 new MiniCssExtractPlugin({
103 filename: '[name].min.css', // Changed to output .min.css files
104 }),
105 ],
106 };
107
108 // Export both configurations
109 module.exports = [unminifiedConfig, minifiedConfig];