Closed dev-b01 closed 4 years ago
Not at all, that's far too high. Can you put together a reproduction?
From what I can see it's mostly @babel/types which are consuming the space, but I'm not sure what dependencies you've installed that might be bringing this into the package.
I went back to the gatsby starter I used as a starting point to create a bug-repo, added the bundle analyzer and now it makes more sense. https://github.com/renvrant/gatsby-mdx-netlify-cms-starter I forgot this project has mdxjs-runtime dependency in it that creates a lot of overhead.
The bundle analyzer "treemap stat" tab would have given that away in the analyzer which I missed the first time I used it.
Update: I was able to use the mdx runtime in the cms environment and reduce main bundle size (10x) as a result of that! For anyone else facing this issue, in onCreateWebpackConfig you can sell webpack to exclude it by using:
actions.setWebpackConfig({
...
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^@mdx-js\/runtime$/
})
]
You can toggle between pre-processed mdx and the unprocessed live markdown using the isPreview prop passed in from netlifycms preview templated
Summary
Trying to optimise my site I ran webpack bundle analyzer v2. I does not make sense to me that @babel would normally take up this much space, but perhaps this is normal?
Relevant information