| Server IP : 185.252.147.100 / Your IP : 216.73.216.43 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/public1/ep3/wp-content/plugins/contact-form-block/ |
Upload File : |
const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
function createConfig(env, options) {
const isProduction = options.mode === 'production';
const isAnalysis = env && env.analysis === 'true';
const plugins = [];
if (isAnalysis) {
plugins.push(new BundleAnalyzerPlugin());
}
const regexNodeModules = /[\\/]node_modules[\\/]/;
const regexNekoUI = /[\\/]neko-ui[\\/]/;
return {
context: __dirname,
mode: isProduction ? 'production' : 'development',
plugins: plugins,
entry: {
index: './app/js/index.js'
},
devtool: isProduction ? 'nosources-source-map' : 'eval-source-map',
output: {
filename: '[name].js',
path: __dirname + '/app/',
chunkLoadingGlobal: 'wpJsonMCFB'
},
optimization: {
minimizer: [new TerserPlugin({
extractComments: false,
})],
splitChunks: {
chunks: 'all',
name: 'vendor',
cacheGroups: {
vendor: {
test: function (module) {
if (module.resource) {
return (module.context.match(regexNodeModules) || module.context.match(regexNekoUI));
}
},
name: "vendor"
}
}
}
},
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
resolve: {
alias: {
'@app': path.resolve(__dirname, './app/js/'),
'@common': path.resolve(__dirname, './common/js/'),
'@neko-ui': path.resolve(__dirname, '../neko-ui/'),
'styled-components': path.resolve('./node_modules/styled-components'),
}
},
module: {
rules: [{
test: /\.js$/,
include: [
path.resolve(__dirname, './app/js/'),
path.resolve(__dirname, './common/js/'),
path.resolve(__dirname, '../neko-ui/'),
],
exclude: [
path.resolve(__dirname, 'node_modules')
],
use: {
loader: 'babel-loader',
options: {
presets: ["@babel/preset-env", "@babel/preset-react"]
}
},
}
]
}
};
}
module.exports = createConfig;