Skip to content

esnext builds are deoptimized by empty types.js files #2896

@GoodForOneFare

Description

@GoodForOneFare

Issue summary

webpack flags any file without an import/export statement as a CommonJS module. CommonJS modules cannot be concatenated, which causes them to be wrapped in webpack boilerplate. This increases asses sizes.

Polaris 4.17.0 ships with multiple empty types.js files (e.g., features). For consumers without sewing-kit's workaround, these add a little bit of bulk :(

But types.js files existed before this!

Yeah, but:

  • Some index files don't export their types
  • Some types files contain non-const enums (which generate exportable code)

Probably other stuff; I haven't looked at this in depth.

But only sewing-kit consumers should be using the esnext build!

Even if that's true, these modules are causing another breakage for all sewing-kit consumers.

Expected behavior

All of Polaris to be treated as es modules.

Actual behavior

Some CommonJS boilerplate 😭

Note: I haven't verified this because all of my consumers use sewing-kit, but I'm usually right about this sort of thing 🤷‍♀

Steps to reproduce the problem

That's pretty involved! If you need help with that, I can cook something up for sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions