Skip to content

Enable hotreload#807

Open
schultek wants to merge 13 commits into
nextfrom
feat/hotreload
Open

Enable hotreload#807
schultek wants to merge 13 commits into
nextfrom
feat/hotreload

Conversation

@schultek

@schultek schultek commented May 9, 2026

Copy link
Copy Markdown
Owner

Description

Enables client-side hotreload in Jaspr

CC @Markzipan

Type of Change

  • ✨ New feature or improvement

Ready Checklist

  • I've read the Contribution Guide.
  • In case this PR changes one of the core packages, I've modified the respective CHANGELOG.md file using
    the semantic_changelog format.
  • I updated/added relevant documentation (doc comments with ///).
  • I added myself to the AUTHORS file (optional, if you want to).

@docs-page

docs-page Bot commented May 9, 2026

Copy link
Copy Markdown

To view this pull requests documentation preview, visit the following URL:

docs.page/schultek/jaspr~807

Documentation is deployed and generated using docs.page.

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

Package Version Report

The following packages have been updated:
jaspr_test : 0.23.1 -> 0.24.0
jaspr : 0.23.1 -> 0.24.0
jaspr_builder : 0.23.1 -> 0.24.0
jaspr_cli : 0.23.1 -> 0.24.0
jaspr_router : 0.8.2 -> 0.8.3
jaspr_lints : 0.7.1 -> 0.7.2
jaspr_content : 0.5.2 -> 0.5.3
jaspr_flutter_embed : 0.4.11 -> 0.4.12
jaspr_riverpod : 0.4.6 -> 0.4.7
jaspr_serverpod : 0.6.1 -> 0.6.2

@schultek schultek changed the base branch from main to next May 9, 2026 18:15
@schultek schultek marked this pull request as ready for review May 9, 2026 18:15

@parlough parlough left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting!! I haven't tried this out yet, but some comments, suggestions, and questions:

webSdkDir,
'kernel',
flutterVersion.compareTo('3.32.0') >= 0 ? 'amd-canvaskit' : 'amd-canvaskit-sound',
flutterVersion.compareTo('3.32.0') >= 0 ? ddcSdkPrefix : '$ddcSdkPrefix-sound',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly unrelated, but I guess we can remove this (and related) handling now. The package's SDK constraint requires Dart 3.8 or later, so Flutter 3.32 or later is required anyway.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep it just a bit longer, but yes then I will remove it.

Comment on lines +368 to +383
// Add DDC Library Bundle defines.
if (usesDdcLibraryBundles) ...[
'--define=build_web_compilers:ddc=ddc-library-bundle=true',
'--define=build_web_compilers:sdk_js=ddc-library-bundle=true',
'--define=build_web_compilers:entrypoint=ddc-library-bundle=true',
'--define=build_web_compilers:entrypoint_marker=ddc-library-bundle=true',
],

// Add Web Hot Reload defines.
if (reloadConfig == ReloadConfiguration.hotReload) ...[
'--define=build_web_compilers:sdk_js=web-hot-reload=true',
'--define=build_web_compilers:entrypoint=web-hot-reload=true',
'--define=build_web_compilers:entrypoint_marker=web-hot-reload=true',
'--define=build_web_compilers:ddc=web-hot-reload=true',
'--define=build_web_compilers:ddc_modules=web-hot-reload=true',
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all of these only be added if the compiler is dartdevc?

logger.write('Starting web compilers...', tag: Tag.cli, progress: ProgressState.running);
logger.write('Starting web compiler...', tag: Tag.cli, progress: ProgressState.running);

final compiler = useWasm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider changing this to a private enum, then any conditional handling can validate you handled each case and spelling mistakes are avoided.

Comment thread packages/jaspr_cli/lib/src/dev/dev_proxy.dart
Comment thread packages/jaspr_cli/lib/src/dev/dev_proxy.dart Outdated
Comment thread packages/jaspr_cli/lib/src/dev/dev_proxy.dart
Comment thread packages/jaspr_cli/lib/src/dev/dev_proxy.dart Outdated
Comment thread packages/jaspr_cli/lib/src/dev/dev_proxy.dart Outdated
Comment thread packages/jaspr_cli/lib/src/dev/dev_proxy.dart
Comment thread pubspec.yaml Outdated
@schultek

schultek commented Jun 8, 2026

Copy link
Copy Markdown
Owner Author

@Markzipan When testing this with build_web_compilers 4.7.0 and 4.8.0 I now get a lot of errors looking like:

[BUILDER] [ERROR] build_web_compilers:ddc (lazy) on stream_channel|lib/src/json_document_transformer.ddc.module:
[BUILDER] [ERROR] Null check operator used on a null value
[BUILDER] [ERROR] #0      Module.computeTransitiveDependencies.<anonymous closure>.<anonymous closure> (package:build_web_compilers/src/build_modules/modules.dart:191:65)
[BUILDER] [ERROR] #1      MappedIterator.moveNext (dart:_internal/iterable.dart:420:20)
[BUILDER] [ERROR] #2      stronglyConnectedComponents (package:graphs/src/strongly_connected_components.dart:84:23)
[BUILDER] [ERROR] #3      Module.computeTransitiveDependencies (package:build_web_compilers/src/build_modules/modules.dart:189:30)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #4      DdcFrontendServerBuilder.build (package:build_web_compilers/src/ddc_frontend_server_builder.dart:64:28)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #5      runBuilder.buildForInput (package:build_runner/src/build/run_builder.dart:85:7)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #6      Future.wait.<anonymous closure> (dart:async/future.dart:546:21)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #7      BuildLogLogger.scopeLogAsync.<anonymous closure> (package:build_runner/src/logging/build_log_logger.dart:58:13)
[BUILDER] [ERROR] <asynchronous suspension>

and

BUILDER] [ERROR] build_web_compilers:ddc (lazy) on test_api|lib/src/backend/remote_exception.ddc.module:
[BUILDER] [ERROR] Bad state: Too many elements
[BUILDER] [ERROR] #0      List.single (dart:core-patch/growable_array.dart:363:5)
[BUILDER] [ERROR] #1      Module.computeTransitiveDependencies.<anonymous closure> (package:build_web_compilers/src/build_modules/modules.dart:195:42)
[BUILDER] [ERROR] #2      MappedListIterable.elementAt (dart:_internal/iterable.dart:442:31)
[BUILDER] [ERROR] #3      ListIterator.moveNext (dart:_internal/iterable.dart:371:26)
[BUILDER] [ERROR] #4      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:194:27)
[BUILDER] [ERROR] #5      new _GrowableList.of (dart:core-patch/growable_array.dart:154:28)
[BUILDER] [ERROR] #6      new List.of (dart:core-patch/array_patch.dart:39:18)
[BUILDER] [ERROR] #7      ListIterable.toList (dart:_internal/iterable.dart:224:7)
[BUILDER] [ERROR] #8      Module.computeTransitiveDependencies (package:build_web_compilers/src/build_modules/modules.dart:195:50)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #9      DdcFrontendServerBuilder.build (package:build_web_compilers/src/ddc_frontend_server_builder.dart:64:28)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #10     runBuilder.buildForInput (package:build_runner/src/build/run_builder.dart:85:7)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #11     Future.wait.<anonymous closure> (dart:async/future.dart:546:21)
[BUILDER] [ERROR] <asynchronous suspension>
[BUILDER] [ERROR] #12     BuildLogLogger.scopeLogAsync.<anonymous closure> (package:build_runner/src/logging/build_log_logger.dart:58:13)
[BUILDER] [ERROR] <asynchronous suspension>

Do you know anything about this?

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.

7 participants