【发布时间】:2021-03-06 22:32:26
【问题描述】:
我正在使用 NextJS 并使用 react-data-export 插件生成 xls 文件。 在它的描述中说:
这个库使用 file-saver 和 xlsx 并使用 json-loader 将为您施展魔法。
///webpack.config.js vendor: [ ..... 'xlsx', 'file-saver' ], ..... node: {fs: 'empty'}, externals: [ {'./cptable': 'var cptable'}, {'./jszip': 'jszip'} ]
但我不知道如何实现它并得到这样的错误:
The static directory has been deprecated in favor of the public directory. https://err.sh/vercel/next.js/static-dir-deprecated
Defining routes from exportPathMap
event - compiled successfully
> Ready on http://localhost:80 or http://localhost
> Ready on https://localhost:443 or https://localhost
event - build page: /menu_accounting/ReportGross
wait - compiling...
error - ./node_modules/react-export-excel/node_modules/xlsx/xlsx.js
Module not found: Can't resolve 'fs' in '/home/ahmadb/repos/lorry-erp/node_modules/react-export-excel/node_modules/xlsx'
Could not find files for /menu_accounting/ReportGross in .next/build-manifest.json
【问题讨论】:
标签: node.js reactjs webpack next.js export-to-excel