surevine / govuk-react-jsx

govuk-frontend compatible React components
https://govuk-react-jsx.netlify.app/
MIT License
3 stars 0 forks source link

Not all dynamic imports receive proper names at build time #85

Open andymantell opened 4 years ago

andymantell commented 4 years ago

Govuk js is imported dynamically and given names with webpack magic comments as follows:

      if (typeof document !== 'undefined') {
        const { default: ButtonJS } = await import(
          /* webpackChunkName: "govuk-frontend-button" */
          /* webpackMode: "lazy" */
          /* webpackPrefetch: true */
          'govuk-frontend/govuk/components/button/button'
        );

        new ButtonJS(buttonRef.current).init();
      }

However, not all of the output files have their names assigned correctly. For example, this is the build output from govuk-react-jsx-examples:

image

Need to work out why...

andymantell commented 4 years ago

Tagging this with Hacktoberfest in case anyone taking part in it this year had any ideas. I'm stumped for the moment on this one. It'll either be something obvious I've missed, or a bug deep in webpack!

Happy to pair up when it comes to it if that would help