Skip to content

Commit

Permalink
fix(compiler): ensure rollup outputs a single file for hydrateFactory (
Browse files Browse the repository at this point in the history
…#4023)

This commit updates the `generateHydrateFactory` function to include the `inlineDynamicImports` flag in the call to Rollup's `generate` function. This change is made to resolve issues with extra chunks getting "thrown away" by the Stencil compiler if they existed. With this option, Rollup is guaranteed to only ever return one chunk so we don't discard extra output resulting in build errors in some cases (like using the `--prerender` flag).

This PR was tested using the project in the PR description by locally building and packing this code and installing into the project. Additional testing was performed in the Ionic Framework by verifying the `angular-server` project builds and generates valid output.

Co-authored-by: Tanner Reits <47483144+tanner-reits@users.noreply.github.com>
  • Loading branch information
George-Payne and tanner-reits authored Feb 6, 2023
1 parent 4af2a81 commit 91092ab
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const generateHydrateFactory = async (config: d.ValidatedConfig, compilerCtx: d.
intro: HYDRATE_FACTORY_INTRO,
outro: HYDRATE_FACTORY_OUTRO,
preferConst: false,
inlineDynamicImports: true,
});

if (!buildCtx.hasError && rollupOutput != null && Array.isArray(rollupOutput.output)) {
Expand Down

0 comments on commit 91092ab

Please sign in to comment.