Use webpack to replace modified version lock lock-unlock

This commit is contained in:
moon 2023-10-23 10:54:41 -07:00
parent 448a7e1fea
commit c9ad56bb64
2 changed files with 13 additions and 7 deletions

View File

@ -1,7 +0,0 @@
const { execSync } = require("child_process");
// Find edit-site module directory
const EDIT_SITE_DIR = execSync("find ../../node_modules/.pnpm -type d -name '@wordpress+edit-site@5.15.0*' -print -quit").toString().trim();
// Replace it with modified version
execSync(`cp -rf "./bin/modified-editsite-lock-unlock.js" ${EDIT_SITE_DIR}/node_modules/@wordpress/edit-site/build-module/lock-unlock.js`);

View File

@ -168,6 +168,19 @@ const webpackConfig = {
},
},
plugins: [
new CopyWebpackPlugin( {
patterns: [
{
from: path.resolve(
__dirname,
'bin/modified-editsite-lock-unlock.js'
), // Replace with the path to your custom script
to: require.resolve(
'@wordpress/edit-site/build-module/lock-unlock.js'
), // Replace with the destination path
},
],
} ),
...styleConfig.plugins,
// Runs TypeScript type checker on a separate process.
! process.env.STORYBOOK && new ForkTsCheckerWebpackPlugin(),