“我目前正在做一个项目,需要将上传的PDF文件转换为HTML。为了实现这一点,我使用了pdf2html包。但是,我在转换过程中遇到了错误。具体的错误消息。
Module not found: Error: Can't resolve 'stream' in '/Users/majidkhan/Desktop/Projects/duralux/node_modules/gm'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
enter code here
我已经安装了这个软件包。
我的目标是将 PDF URL 转换为 HTML 格式。我已经尝试过[提及您尝试过的任何具体步骤或方法],但我还无法解决该问题。
我将非常感谢任何可以帮助我解决此问题的见解、建议或解决方案。
正如错误消息所示:
webpack.config.js
:
module.exports = {
resolve: {
fallback: {
stream: require.resolve("stream-browserify")
},
},
};