Skip to content

bug: stencil build --watch hangs on “generate lazy” when importing large files after Rollup 4 upgrade #6253

@talaat197

Description

@talaat197

Prerequisites

Stencil Version

4.30.0

Current Behavior

When running stencil build --dev --watch --serve, everything initially works fine. However, after making a change in the main component, the rebuild gets stuck at:

transpile started ...
transpile finished in 380 ms
generate lazy + source maps started ...

It never proceeds beyond “generate lazy”, and the process hangs indefinitely.

Stencil versions prior to 4.28.0 (before Rollup was upgraded to v4)

  • Reducing or commenting out the number of tinymce imports allows rebuild to complete again.
  • Downgrading to Stencil <= 4.27.4 (with Rollup v2) also resolves the problem.

Expected Behavior

Hot Reloading: make the rebuild works fine even if it includes big files

System Info

OS: macOS
Stencil version: 4.28.0+ (problem introduced here)
Rollup: 4.x (as introduced in Stencil 4.28.0)

Steps to Reproduce

  • Use stencil build --dev --watch --serve.
  • Import several large files in your main component. For example:

example:

import 'tinymce/icons/default';
import 'tinymce/themes/silver';
import 'tinymce/models/dom';

import 'tinymce/plugins/lists';
import 'tinymce/plugins/advlist';
import 'tinymce/plugins/emoticons';
import 'tinymce/plugins/directionality';
import 'tinymce/plugins/link';
import 'tinymce/plugins/autolink';
  • Make any change in the main component file.
  • Rebuild will hang on generate lazy.

Code Reproduction URL

https://

Additional Information

Debugging the @stencil/core I found that it stucks within the await roullup call when the roullup options has a cache been set, if I set the cache to undefined or false it works fine.

export const bundleOutput = async (
  config: d.ValidatedConfig,
  compilerCtx: d.CompilerCtx,
  buildCtx: d.BuildCtx,
  bundleOpts: BundleOptions,
) => {
  try {
    const rollupOptions = getRollupOptions(config, compilerCtx, buildCtx, bundleOpts);
    console.log('bundleOutput before rollup?',
      {
        rollupOptions,
      });

    const rollupBuild = await rollup(rollupOptions);

    console.log('bundleOutput after rollup?')


    compilerCtx.rollupCache.set(bundleOpts.id, rollupBuild.cache);
    return rollupBuild;

'bundleOutput after rollup?' will never been reached

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