when i run the script it show me this errors Here is error:
BREAKING CHANGE:webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to: add a fallback 'resolve.fallback: { "util": require.resolve("util/") }', install 'util';
If you don't want to include a polyfill, you can use an empty module like this:resolve.fallback: { "util": false }
@ ./node_modules/webpack/lib/index.js 74:30-50 77:9-29
@ ./src/googlesheets.js 21:16-34
@ ./src/index.js 1:0-44 2:0-10
The main problem is with Webpack 5. It doesn't preload the polyfill of Node.js. I see that this issue can help you. https://github.com/webpack/webpack/issues/11282
To solve it: npm install util, and add it into webpack.config.js:
module.exports = {
// ...
resolve: {
fallback: {
util: require.resolve("util/")
}
}
// ...
};
If your code is multi-target (node & browser), follow the other answers. If your code will only run on nodejs, this suffices:
module.exports = {
target: "node", // Or "async-node"
mode: "production" /* or "development", or "none" */
/* ... */
}
For me, it was enough to do yarn add util (alternatively, npm install util). I didn't have to add it to any other files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With