Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rolldown-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@solidjs/vite-plugin': patch
---

Build the package with Rolldown instead of Rollup and Babel. The published bundle no longer carries source comments (its sourcemap still embeds the commented sources), which makes `dist/esm/index.mjs` about 40% smaller.
4 changes: 2 additions & 2 deletions examples/start-ssr/test/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5810,7 +5810,7 @@ async function runNodeMode() {
mode,
'build',
'entry imports the sibling server bundle relatively',
nodeSource.includes("from './server.js'"),
/from ['"]\.\/server\.js['"]/.test(nodeSource),
);
const specifiers = [...nodeSource.matchAll(/^import\b[^'"]*['"]([^'"]+)['"]/gm)].map(
(m) => m[1],
Expand Down Expand Up @@ -6407,7 +6407,7 @@ async function runNodeMode() {
'cf',
'cloudflare-shaped build with start.nodeServer emits node.js pointing at the client dir',
cfNodeSource.includes('"clientDir":"../client"') &&
cfNodeSource.includes("from './server.js'"),
/from ['"]\.\/server\.js['"]/.test(cfNodeSource),
cfNodeSource.match(/^const SOLID_NODE_CONFIG = .*$/m)?.[0] ?? 'no node.js',
);
} catch (e) {
Expand Down
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
}
},
"scripts": {
"build": "rollup -c && tsc --noEmit && tsc -p tsconfig.build.json",
"dev": "rollup -c -w",
"build": "rolldown -c && tsc --noEmit && tsc -p tsconfig.build.json",
"dev": "rolldown -c -w",
"prepublishOnly": "pnpm build",
"release": "pnpm build && changeset publish",
"check": "package-check",
Expand Down Expand Up @@ -68,12 +68,7 @@
"vitefu": "^1.0.4"
},
"devDependencies": {
"@babel/preset-env": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@changesets/cli": "^2.30.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@skypack/package-check": "^0.2.2",
"@solidjs/diagnostics": "2.0.0-rc.19",
"@solidjs/start-devtools": "^1.0.0-next.3",
Expand All @@ -84,8 +79,7 @@
"cypress-vite": "^1.6.0",
"cypress-wait-until": "^3.0.2",
"prettier": "^3.1.0",
"rollup": "^4.5.0",
"rollup-plugin-cleaner": "^1.0.0",
"rolldown": "^1.2.16",
"solid-js": "^2.0.0-rc.19",
"typescript": "^5.2.2",
"vite": "^8.2.1",
Expand Down
2,158 changes: 248 additions & 1,910 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions rolldown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { rmSync } from 'node:fs';
import { defineConfig } from 'rolldown';

// A fresh dist/ on every build, the declarations included.
rmSync('dist', { recursive: true, force: true });

// The oldest Node the package supports (engines).
const transform = { target: 'node22.12' };

const external = [
'@babel/core',
'@solidjs/compiler',
'@ampproject/remapping',
'@solidjs/babel-plugin',
'merge-anything',
'vitefu',
'magic-string',
'vite',
];

export default defineConfig([
{
input: 'src/index.ts',
platform: 'node',
transform,
external,
// ESM only: Vite is ESM-only, and the Node versions the plugin supports
// (22.12+) load this build through require() too.
output: {
format: 'esm',
file: 'dist/esm/index.mjs',
sourcemap: true,
},
},
/**
* The runtime of the Node server entry `start.nodeServer` emits into a
* build's dist/server/node.js: the plugin reads this artifact at build time
* and prepends the emit-time constants. Bundles the shared node<->web
* bridge (src/http.ts) with it; `./server.js` (the sibling server bundle)
* stays an external import, kept verbatim so it resolves in the user's
* dist. Comments are stripped: this file lands in every user's dist, and
* the source files keep the explanations.
*/
{
input: 'src/node-entry/index.ts',
platform: 'node',
transform,
external: (id) => id === './server.js' || id.startsWith('node:'),
makeAbsoluteExternalsRelative: false,
// No `// <module id>` markers either.
experimental: { attachDebugInfo: 'none' },
output: {
format: 'esm',
file: 'dist/node-entry.mjs',
comments: false,
},
},
]);
75 changes: 0 additions & 75 deletions rollup.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/node-entry/server.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Type shim for the sibling server bundle the emitted `node.js` imports at
// runtime (`dist/server/server.js`, whose entry is virtual:solid-ssr-handler).
// The import stays external in the runtime artifact — see rollup.config.js.
// The import stays external in the runtime artifact (see rolldown.config.ts).
export function handleRequest(
request: Request,
options?: { event?: Record<string, unknown> },
Expand Down
2 changes: 1 addition & 1 deletion src/ssr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ const SERVER_ENTRY_FILE = 'server.js';
const NODE_ENTRY_FILE = 'node.js';
// With `start.serverSetup`, node.js only sequences and the runtime moves here.
const NODE_RUNTIME_FILE = 'node-runtime.js';
// The Node entry's runtime, built by rollup.config.js as a separate artifact
// The Node entry's runtime, built by rolldown.config.ts as a separate artifact
// of this package (dist/node-entry.mjs) from src/node-entry/index.ts plus
// the shared bridge in src/http.ts. Located relative to the plugin module
// itself: the plugin build (dist/esm/index.mjs) sits one directory below it.
Expand Down
Loading