There is no error when webpack packages json.stringify (), but the following error is reported on the page:

However, when I change it to window.json.stringify, it’s fine.

The solution was to add the target field to the Webpack configuration and set it to ‘node’.

module.export = { entry:{}, output:{}, ... . . plugins:[], ... target:'node'
}
Copy the code

Can according to own situation reference website: webpack. Making. IO/docs/config…