Skip to content

refactor(bundling): Improve build times#43

Open
Rhaoma wants to merge 1 commit intomatraic:mainfrom
Rhaoma:fix/rollup-bundling
Open

refactor(bundling): Improve build times#43
Rhaoma wants to merge 1 commit intomatraic:mainfrom
Rhaoma:fix/rollup-bundling

Conversation

@Rhaoma
Copy link

@Rhaoma Rhaoma commented Mar 22, 2026


Improving build times

We briefly touched on the extensive build times of M3E in #31, with build times on a fast machine exceeding 3-4 minutes.
During local development I came up with an alternative build config, where the components are built as a single job instead of one by one. It isn't definitively better, but i'll leave it here in case it is useful to someone

Complete build of Web + React takes about 40s.
An incremental build of Web (index.js and all the components) is about 12s

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe)

@matraic matraic self-assigned this Mar 22, 2026
@matraic
Copy link
Owner

matraic commented Mar 23, 2026

@Rhaoma

This is fantastic! However, tslib is being externalized into tslib.es6.js and written to the dist folder. A reason to inline tslib is to simplify bare module imports into the browser (it's pretty small).

The tsconfig.json wasn't being loading so the following was tried but that hasn't helped either.

export default createConfig({
  inputs: inputs,
  externals: [/^@m3e\//, /^lit$/, /^lit\//, /^@lit\/reactive-element$/, /^@lit\/reactive-element\//],
  config: {
    typescriptConfig: {
      tsconfig: fileURLToPath(new URL("./tsconfig.json", import.meta.url)),
    },
  },
});

Thoughts?

@matraic
Copy link
Owner

matraic commented Mar 23, 2026

It does look like rollup has a limitation with multiple inputs like this where it does not support inlining tslib whatsoever. Suppose the tslib externalization is just an issue for bare module imports into the browser which is an uncommon scenario.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants