Child_process in admin pages

System Information
  • Strapi Version: 3.6.5
  • Operating System: OSX
  • Database: mysql
  • Node Version: v14.17.0
  • NPM Version: 6.14.13

Hi I want to add a button into the admin screen to manually trigger a command on the server.

I’ve updated admin/src/containers/HomePage/index.js with something trivial like -

const { exec } = require("child_process");
exec('echo > bob.txt');

which gives me this error while compiling

This dependency was not found:

* child_process in ./.cache/admin/src/containers/HomePage/index.js

To install it, you can run: npm install --save child_process

If I install that package it gives me some empty security holding package but it’s my understanding that it’s included with node now?

I’ve read that I might need to update the webpack config with something along the lines of

node: {
  child_process: "empty"
  fs: "empty", // if unable to resolve "fs"

but I can’t seem to get that to work either.

Any clues on what I need to do would be much appreciated.