我正在开发React应用。
此刻,在我的主应用程序中,我正在使用从外部应用程序导入的内容(准备发布的库-两个目录),该应用程序使用与主应用程序相同的依赖项。
我有一个问题,我的Web包构建了一个组件事件3000次!
我在主应用程序的Web Pack中添加了一些别名,但只减少了一点。
有人知道如何摆脱成千上万的相同组件吗?
53% building modules 4983/6870 modules 1887 active ...\buttons\project\style.js
53% building modules 4985/6870 modules 1885 active ...\buttons\project\style.js
53% building modules 4987/6870 modules 1883 active ...\buttons\project\style.js
53% building modules 4988/6870 modules 1882 active ...\buttons\project\style.js
53% building modules 4991/6870 modules 1879 active ...\buttons\project\style.js
53% building modules 4992/6870 modules 1878 active ...\buttons\project\style.js
53% building modules 4993/6870 modules 1877 active ...\buttons\project\style.js
53% building modules 4995/6870 modules 1875 active ...\buttons\project\style.js
53% building modules 5000/6870 modules 1870 active ...\buttons\project\style.js
53% building modules 5002/6870 modules 1868 active ...\buttons\project\style.js
53% building modules 5003/6870 modules 1867 active ...\buttons\project\style.js
53% building modules 5004/6870 modules 1866 active ...\buttons\project\style.js
53% building modules 5005/6870 modules 1865 active ...\buttons\project\style.js
53% building modules 5013/6870 modules 1857 active ...\buttons\project\style.js
53% building modules 5014/6870 modules 1856 active ...\buttons\project\style.js
53% building modules 5015/6870 modules 1855 active ...\buttons\project\style.js
53% building modules 5017/6870 modules 1853 active ...\buttons\project\style.js
53% building modules 5018/6870 modules 1852 active ...\buttons\project\style.js
53% building modules 5020/6870 modules 1850 active ...\buttons\project\style.js
53% building modules 5022/6870 modules 1848 active ...\buttons\project\style.js
53% building modules 5023/6870 modules 1847 active ...\buttons\project\style.js
53% building modules 5024/6870 modules 1846 active ...\buttons\project\style.js
53% building modules 5026/6870 modules 1844 active ...\buttons\project\style.js
53% building modules 5036/6870 modules 1834 active ...\buttons\project\style.js
Web Pack配置的一部分:
resolve: {
extensions: ['.ts', '.js', '.jsx'],
alias: {
"app-config": `./${NODE_ENV}.js`,
recompose: path.resolve('./node_modules/material-ui/node_modules/recompose'),
kotlin: path.resolve('./node_modules/kotlin'),
warning: path.resolve('./node_modules/warning'),
"hoist-non-react-statics": path.resolve('./node_modules/hoist-non-react-statics'),
"object-assign": path.resolve('./node_modules/react-themeable/node_modules/object-assign'),
"lodash.merge": path.resolve('./node_modules/webpack-merge/node_modules/lodash.merge'),
isarray: path.resolve('./node_modules/isarray'),
"material-ui": path.resolve('./node_modules/material-ui'),
"@material-ui": path.resolve('./node_modules/@material-ui'),
"lodash": path.resolve('./node_modules/lodash'),
"lodash._baseEach": path.resolve('./node_modules/lodash._baseeach'),
谢谢!
答案 0 :(得分:-1)
我不确定,但这可能是将组件递归导入的地方...