welcome everybody.
can you help me with it?
the code:
// webpack.config.js
const webpack = require('webpack');
const fs = require('fs');
const archiver = require('archiver');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const WebpackObfuscator = require('webpack-obfuscator');
const {version} = require('./package.json');
const triggerAfterBuild = function (cb) {
this.apply = function (compiler) {
if (compiler.hooks && compiler.hooks.done) {
compiler.hooks.done.tap('webpack-arbitrary-code', cb);
}
};
};
module.exports = function (env, argv) {
const prod = env.production || false;
const build = prod ? 'dist' : 'local';
const {pluginId, pluginName} = require('./src/env/config.' + build);
const {id: pluginIdDev, name: pluginNameDev} = require('./src/manifest.json');
const path = require('path').resolve(__dirname, 'build/' + build);
const callbackAfterBuild = function () {
const manifestFile = `${path}\\manifest.json`;
<...>
};
return {
mode: 'production',
entry: './src/index.js',
output: {
path: path,
filename: 'index.js',
},
externals: {
'uxp': 'commonjs uxp',
'photoshop': 'commonjs photoshop',
'locales': 'commonjs locales'
},
plugins: [
new CleanWebpackPlugin(),
new webpack.NormalModuleReplacementPlugin(
/..\/env\/config/ig,
'../env/config.' + build
),
new CopyPlugin({
patterns: [
{from: 'src/icons', to: `${path}/icons`},
{from: 'src/locales', to: `${path}/locales`},
{from: 'src/manifest.json', to: `${path}/manifest.json`},
],
}),
new WebpackObfuscator({
debugProtection: true,
disableConsoleOutput: true,
selfDefending: true,
}),
new triggerAfterBuild(callbackAfterBuild),
]
};
};
I have a problem
1- archiver.
2- webpack-obfuscator.
3- package.json…
4- use loadash
I’ve tried but my attempts failed