Skip to content

Commit b2b8655

Browse files
committed
Fixed web target not working due to worker issue.
1 parent 6e00b7e commit b2b8655

File tree

5 files changed

+84
-79
lines changed

5 files changed

+84
-79
lines changed

demos/local-only-todolist/.metadata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ migration:
1515
- platform: root
1616
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
1717
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
18-
- platform: macos
18+
- platform: web
1919
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
2020
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
2121

demos/local-only-todolist/lib/models/sync_mode.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ openSyncModeDatabase() async {
2424
path = join(dir.path, dbFilename);
2525
}
2626

27-
sqliteDb = SqliteDatabase(path: path);
27+
sqliteDb = SqliteDatabase(
28+
path: path,
29+
options: const SqliteOptions(
30+
webSqliteOptions: WebSqliteOptions(workerUri: 'powersync_db.worker.js'),
31+
),
32+
);
2833
await migrations.migrate(sqliteDb);
2934
}
3035

demos/local-only-todolist/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ environment:
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
powersync: ^1.6.0
13+
powersync: ^1.6.7
1414
path_provider: ^2.1.1
1515
supabase_flutter: ^2.0.1
1616
path: ^1.8.3
Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<!--
3+
<head>
4+
<!--
55
If you are serving your web app in a path other than the root, change the
66
href value below to reflect the base path you are serving from.
77
@@ -14,46 +14,46 @@
1414
This is a placeholder for base href that will be replaced by the value of
1515
the `--base-href` argument provided to `flutter build`.
1616
-->
17-
<base href="$FLUTTER_BASE_HREF">
18-
19-
<meta charset="UTF-8">
20-
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21-
<meta name="description" content="A new Flutter project.">
22-
23-
<!-- iOS meta tags & icons -->
24-
<meta name="apple-mobile-web-app-capable" content="yes">
25-
<meta name="apple-mobile-web-app-status-bar-style" content="black">
26-
<meta name="apple-mobile-web-app-title" content="supabase_todolist">
27-
<link rel="apple-touch-icon" href="icons/Icon-192.png">
28-
29-
<!-- Favicon -->
30-
<link rel="icon" type="image/png" href="favicon.png"/>
31-
32-
<title>supabase_todolist</title>
33-
<link rel="manifest" href="manifest.json">
34-
35-
<script>
36-
// The value below is injected by flutter build, do not touch.
37-
const serviceWorkerVersion = null;
38-
</script>
39-
<!-- This script adds the flutter initialization JS code -->
40-
<script src="flutter.js" defer></script>
41-
</head>
42-
<body>
43-
<script>
44-
window.addEventListener('load', function(ev) {
45-
// Download main.dart.js
46-
_flutter.loader.loadEntrypoint({
47-
serviceWorker: {
48-
serviceWorkerVersion: serviceWorkerVersion,
49-
},
50-
onEntrypointLoaded: function(engineInitializer) {
51-
engineInitializer.initializeEngine().then(function(appRunner) {
52-
appRunner.runApp();
53-
});
54-
}
17+
<base href="$FLUTTER_BASE_HREF" />
18+
19+
<meta charset="UTF-8" />
20+
<meta content="IE=Edge" http-equiv="X-UA-Compatible" />
21+
<meta name="description" content="A new Flutter project." />
22+
23+
<!-- iOS meta tags & icons -->
24+
<meta name="apple-mobile-web-app-capable" content="yes" />
25+
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
26+
<meta name="apple-mobile-web-app-title" content="local_only_todolist" />
27+
<link rel="apple-touch-icon" href="icons/Icon-192.png" />
28+
29+
<!-- Favicon -->
30+
<link rel="icon" type="image/png" href="favicon.png" />
31+
32+
<title>local_only_todolist</title>
33+
<link rel="manifest" href="manifest.json" />
34+
35+
<script>
36+
// The value below is injected by flutter build, do not touch.
37+
const serviceWorkerVersion = null;
38+
</script>
39+
<!-- This script adds the flutter initialization JS code -->
40+
<script src="flutter.js" defer></script>
41+
</head>
42+
<body>
43+
<script>
44+
window.addEventListener("load", function (ev) {
45+
// Download main.dart.js
46+
_flutter.loader.loadEntrypoint({
47+
serviceWorker: {
48+
serviceWorkerVersion: serviceWorkerVersion,
49+
},
50+
onEntrypointLoaded: function (engineInitializer) {
51+
engineInitializer.initializeEngine().then(function (appRunner) {
52+
appRunner.runApp();
53+
});
54+
},
55+
});
5556
});
56-
});
57-
</script>
58-
</body>
57+
</script>
58+
</body>
5959
</html>
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
{
2-
"name": "supabase_todolist",
3-
"short_name": "supabase_todolist",
4-
"start_url": ".",
5-
"display": "standalone",
6-
"background_color": "#0175C2",
7-
"theme_color": "#0175C2",
8-
"description": "A new Flutter project.",
9-
"orientation": "portrait-primary",
10-
"prefer_related_applications": false,
11-
"icons": [
12-
{
13-
"src": "icons/Icon-192.png",
14-
"sizes": "192x192",
15-
"type": "image/png"
16-
},
17-
{
18-
"src": "icons/Icon-512.png",
19-
"sizes": "512x512",
20-
"type": "image/png"
21-
},
22-
{
23-
"src": "icons/Icon-maskable-192.png",
24-
"sizes": "192x192",
25-
"type": "image/png",
26-
"purpose": "maskable"
27-
},
28-
{
29-
"src": "icons/Icon-maskable-512.png",
30-
"sizes": "512x512",
31-
"type": "image/png",
32-
"purpose": "maskable"
33-
}
34-
]
2+
"name": "local_only_todolist",
3+
"short_name": "local_only_todolist",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"background_color": "#0175C2",
7+
"theme_color": "#0175C2",
8+
"description": "A new Flutter project.",
9+
"orientation": "portrait-primary",
10+
"prefer_related_applications": false,
11+
"icons": [
12+
{
13+
"src": "icons/Icon-192.png",
14+
"sizes": "192x192",
15+
"type": "image/png"
16+
},
17+
{
18+
"src": "icons/Icon-512.png",
19+
"sizes": "512x512",
20+
"type": "image/png"
21+
},
22+
{
23+
"src": "icons/Icon-maskable-192.png",
24+
"sizes": "192x192",
25+
"type": "image/png",
26+
"purpose": "maskable"
27+
},
28+
{
29+
"src": "icons/Icon-maskable-512.png",
30+
"sizes": "512x512",
31+
"type": "image/png",
32+
"purpose": "maskable"
33+
}
34+
]
3535
}

0 commit comments

Comments
 (0)