Open 7iomka opened 8 months ago
Hi @7iomka
I have published a new version of the plugin (v1.0.8) that should address the issue. Please update your version accordingly.
Please note that I have also updated the readme file, so be sure to modify your webpack config file as follows:
"plugins": ["transform-barrels", { webpackConfigFilename: __filename, ...(typeof module.exports === "function" && { args: arguments })}]
Please try it and let me know if it resolves your issue.
Thanks
why do you need the webpackConfigFilename
?
Hi @sibelius
Because it needs to read aliases from the Webpack config file.
Wouldn't it be better if you just take an alias map object instead of taking a path to webpack config? People can just reuse their alias map.
Hi @anilanar Because it is an easier configuration, you just use the same configuration for every project as it appears in the readme.md and it should work. Is there a reason that you prefer the alias option in the plugin configuration instead of a path to the webpack config?
Hi. I tried to use your solution for this case:
I have
entity
, lets call itcompare
root index file exports public api of this entity:
or in some cases when entity have multiple components or utils to export:
So, each page of my next.js application include
BaseLayout
component, which need to import just$$compare
model to use event from it inside useEffect.If I import like this, I have all component from ui inside initial chunk for all the pages that uses BaseLayout
Only when I replaced all imports to direct imports - I see expected result
Any suggestion why your plugin can't do this manual work for me? I have a huge code base. and I don't know how long it would take me to manually redo it. Furthermore. I don't want to do it because I need to know what the private api (structure) of the module is. That is, it breaks the whole understanding of public api, when the outside world knows nothing about the internal structure of the module. But I suppose it can be neglected considering that otherwise I get just hundreds of extra kilobytes in the bundle of each page.
Many thanks.