diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.0.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.0.html
new file mode 100644
index 0000000..5325fc5
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.0.html
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.1.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.1.html
new file mode 100644
index 0000000..2284b57
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.1.html
@@ -0,0 +1,21 @@
+
+
+
+ Mounted: false Clicks: 0
+
+
+ Mounted: false Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.2.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.2.html
new file mode 100644
index 0000000..48471e3
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.2.html
@@ -0,0 +1,21 @@
+
+
+
+ Mounted: true Clicks: 0
+
+
+ Mounted: true Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.3.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.3.html
new file mode 100644
index 0000000..44c04cf
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.loading.3.html
@@ -0,0 +1,32 @@
+
+
+
+ Mounted: true Clicks: 0
+
+
+
+
+ Mounted: true Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.step-0.0.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.step-0.0.html
new file mode 100644
index 0000000..efe58aa
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/build.expected.step-0.0.html
@@ -0,0 +1,21 @@
+
+
+
+ Mounted: true Clicks: 1
+
+
+ Mounted: true Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.0.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.0.html
new file mode 100644
index 0000000..bbd199f
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.0.html
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.1.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.1.html
new file mode 100644
index 0000000..9f8122c
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.1.html
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.10.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.10.html
new file mode 100644
index 0000000..9cb6983
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.10.html
@@ -0,0 +1,33 @@
+
+
+ Mounted: true Clicks: 0
+
+
+
+
+
+ Mounted: true Clicks: 0
+
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.2.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.2.html
new file mode 100644
index 0000000..44229a2
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.2.html
@@ -0,0 +1,23 @@
+
+
+
+ Mounted: false Clicks: 0
+
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.3.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.3.html
new file mode 100644
index 0000000..7baf2c7
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.3.html
@@ -0,0 +1,28 @@
+
+
+
+ Mounted: false Clicks: 0
+
+
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.4.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.4.html
new file mode 100644
index 0000000..44f8e5a
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.4.html
@@ -0,0 +1,36 @@
+
+
+
+ Mounted: false Clicks: 0
+
+
+
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.5.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.5.html
new file mode 100644
index 0000000..cc227ea
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.5.html
@@ -0,0 +1,41 @@
+
+
+
+ Mounted: false Clicks: 0
+
+
+
+
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.6.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.6.html
new file mode 100644
index 0000000..9fea173
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.6.html
@@ -0,0 +1,46 @@
+
+
+
+ Mounted: false Clicks: 0
+
+
+
+
+
+
+ Mounted: false Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.7.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.7.html
new file mode 100644
index 0000000..6667f64
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.7.html
@@ -0,0 +1,20 @@
+
+ Mounted: false Clicks: 0
+
+
+
+
+ Mounted: false Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.8.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.8.html
new file mode 100644
index 0000000..f43e2cb
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.8.html
@@ -0,0 +1,20 @@
+
+ Mounted: true Clicks: 0
+
+
+
+
+ Mounted: true Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.9.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.9.html
new file mode 100644
index 0000000..1cb91a7
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.loading.9.html
@@ -0,0 +1,33 @@
+
+
+ Mounted: false Clicks: 0
+
+
+
+
+
+ Mounted: false Clicks: 0
+
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.step-0.0.html b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.step-0.0.html
new file mode 100644
index 0000000..2229265
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/__snapshots__/dev.expected.step-0.0.html
@@ -0,0 +1,20 @@
+
+ Mounted: true Clicks: 1
+
+
+
+
+ Mounted: true Clicks: 0
+
\ No newline at end of file
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/dev-server.mjs b/src/__tests__/fixtures/isomorphic-bundle-splitting/dev-server.mjs
new file mode 100644
index 0000000..64b889d
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/dev-server.mjs
@@ -0,0 +1,38 @@
+// In dev we'll start a Vite dev server in middleware mode,
+// and forward requests to our http request handler.
+
+import { createServer } from "vite";
+import path from "path";
+import url from "url";
+import { createRequire } from "module";
+
+// change to import once marko-vite is updated to ESM
+const markoPlugin = createRequire(import.meta.url)("../../..").default;
+
+const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
+
+const devServer = await createServer({
+ root: __dirname,
+ appType: "custom",
+ logLevel: "silent",
+ plugins: [markoPlugin()],
+ optimizeDeps: { force: true },
+ server: {
+ middlewareMode: true,
+ watch: {
+ ignored: ["**/node_modules/**", "**/dist/**", "**/__snapshots__/**"],
+ },
+ },
+});
+
+export default devServer.middlewares.use(async (req, res, next) => {
+ try {
+ const { handler } = await devServer.ssrLoadModule(
+ path.join(__dirname, "./src/index.js")
+ );
+ await handler(req, res, next);
+ } catch (err) {
+ devServer.ssrFixStacktrace(err);
+ return next(err);
+ }
+});
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/server.mjs b/src/__tests__/fixtures/isomorphic-bundle-splitting/server.mjs
new file mode 100644
index 0000000..410eee8
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/server.mjs
@@ -0,0 +1,15 @@
+// In production, simply start up the http server.
+import path from 'path'
+import url from 'url';
+import { createServer } from "http";
+import serve from "serve-handler";
+import { handler } from "./dist/index.mjs";
+
+const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
+const serveOpts = { public: path.resolve(__dirname, "dist") };
+
+export default createServer(async (req, res) => {
+ await handler(req, res);
+ if (res.headersSent) return;
+ await serve(req, res, serveOpts);
+});
diff --git a/src/__tests__/fixtures/isomorphic-bundle-splitting/src/components/class-component.marko b/src/__tests__/fixtures/isomorphic-bundle-splitting/src/components/class-component.marko
new file mode 100644
index 0000000..9579382
--- /dev/null
+++ b/src/__tests__/fixtures/isomorphic-bundle-splitting/src/components/class-component.marko
@@ -0,0 +1,20 @@
+class {
+ onCreate() {
+ this.state = {
+ clickCount: 0,
+ mounted: false
+ };
+ }
+ onMount() {
+ this.state.mounted = true;
+ }
+
+ handleClick() {
+ this.state.clickCount++;
+ }
+}
+
+