Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge bundle size #19

Closed
karolis-sh opened this issue May 31, 2019 · 3 comments
Closed

Huge bundle size #19

karolis-sh opened this issue May 31, 2019 · 3 comments

Comments

@karolis-sh
Copy link

karolis-sh commented May 31, 2019

Hi, I tried to launch your gatsby-starter-default-intl demo with added gatsby-plugin-webpack-bundle-analyzer. Despite only languages: ['en', 'ko', 'de'], being enabled, all of the locales are bundled with the app (this adds quite a significant amount of extra bundle size):

image

@jondavidjohn
Copy link

I built a tool to help you analyze webpack bundles for size regressions, and report them directly to GitHub PRs. It's free for open source, so it might be worth checking out and helpful in this scenario.

https://packtracker.io

image

@BowlingX
Copy link

BowlingX commented Jun 4, 2019

This can be fixed with a gatsby-node.js file like this:
I would suggest to have this included based on the languages inside the plugin.

/**
 * Implement Gatsby's Node APIs in this file.
 *
 * See: https://www.gatsbyjs.org/docs/node-apis/
 */

// You can delete this file if you're not using it

const webpack = require('webpack')

exports.onCreateWebpackConfig = ({ actions: { setWebpackConfig } }) => {
  setWebpackConfig({
    plugins: [
      new webpack.ContextReplacementPlugin(/react-intl[/\\]locale-data$/, /de|en/)
    ]
  })
}

@wiziple
Copy link
Owner

wiziple commented Jun 5, 2019

@BowlingX Thanks!

@buz-zard This issue should be fixed on the next release.
Meanwhile, you can use by doing npm install --save gatsby-plugin-intl@beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants