汇总 EMFILE:打开的文件太多,带有 material-ui 图标
Rollup EMFILE: too many open files, with material-ui icons
我有一个设计系统,它是 Material-ui 版本 5 之上的 built。我使用 rollup 作为我的打包器。
在其中一个自定义组件中,我从 Mui5 import { Search } from "@material-ui/icons"
导入了一个图标
当我 uild 使用汇总时,出现以下错误,我不确定如何修复:
!] Error: Could not load E:\project\node_modules\@material-ui\icons\esm\TransitEnterexitSharp.js
(imported by node_modules\@material-ui\icons\esm\index.js): EMFILE: too many open files, open 'E:\project\node_modules\@material-ui\icons\esm\TransitEnterexitSharp.js'
汇总中缺少什么配置?它具有以下配置:
export default {
input: "src/index.ts",
output: [
{
file: packageJson.main,
format: "cjs",
sourcemap: true
},
{
file: packageJson.module,
format: "esm",
sourcemap: true
}
],
plugins: [
peerDepsExternal(),
resolve(),
commonjs(),
babel({
plugins:
[
// comes from https://material-ui.com/guides/minimizing-bundle-size/#option-2
[
'babel-plugin-import',
{
'libraryName': '@material-ui/core',
'libraryDirectory': 'esm',
'camel2DashComponentName': false
},
'core'
],
[
'babel-plugin-import',
{
'libraryName': '@material-ui/icons',
'libraryDirectory': 'esm',
'camel2DashComponentName': false
},
'icons'
]
],
exclude: 'node_modules/**',
runtimeHelpers: true
}),
typescript({ useTsconfigDeclarationDir: true }),
svgr(),
image(),
copy({
targets: [
{
src: "package.json",
dest: "dist"
}
]
})
]
};
我也试过 umidbekk/babel-plugin-direct-import 但没用。
事实证明这是在 Rollup 中修复的 v2.53.0 that referenced my exact issue https://github.com/rollup/rollup/pull/4170#issue-684709217
我有一个设计系统,它是 Material-ui 版本 5 之上的 built。我使用 rollup 作为我的打包器。
在其中一个自定义组件中,我从 Mui5 import { Search } from "@material-ui/icons"
当我 uild 使用汇总时,出现以下错误,我不确定如何修复:
!] Error: Could not load E:\project\node_modules\@material-ui\icons\esm\TransitEnterexitSharp.js
(imported by node_modules\@material-ui\icons\esm\index.js): EMFILE: too many open files, open 'E:\project\node_modules\@material-ui\icons\esm\TransitEnterexitSharp.js'
汇总中缺少什么配置?它具有以下配置:
export default {
input: "src/index.ts",
output: [
{
file: packageJson.main,
format: "cjs",
sourcemap: true
},
{
file: packageJson.module,
format: "esm",
sourcemap: true
}
],
plugins: [
peerDepsExternal(),
resolve(),
commonjs(),
babel({
plugins:
[
// comes from https://material-ui.com/guides/minimizing-bundle-size/#option-2
[
'babel-plugin-import',
{
'libraryName': '@material-ui/core',
'libraryDirectory': 'esm',
'camel2DashComponentName': false
},
'core'
],
[
'babel-plugin-import',
{
'libraryName': '@material-ui/icons',
'libraryDirectory': 'esm',
'camel2DashComponentName': false
},
'icons'
]
],
exclude: 'node_modules/**',
runtimeHelpers: true
}),
typescript({ useTsconfigDeclarationDir: true }),
svgr(),
image(),
copy({
targets: [
{
src: "package.json",
dest: "dist"
}
]
})
]
};
我也试过 umidbekk/babel-plugin-direct-import 但没用。
事实证明这是在 Rollup 中修复的 v2.53.0 that referenced my exact issue https://github.com/rollup/rollup/pull/4170#issue-684709217