Skip to content
Open
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
16 changes: 5 additions & 11 deletions packages/core/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ if (buildLib) {
rmSync(distDir, { recursive: true, force: true })
mkdirSync(distDir, { recursive: true })

const externalDeps: string[] = [
...Object.keys(packageJson.optionalDependencies || {}),
...Object.keys(packageJson.peerDependencies || {}),
]

// Build main entry point
if (!packageJson.module) {
console.error("Error: 'module' field not found in package.json")
Expand All @@ -195,18 +190,18 @@ if (buildLib) {

const entryPoints: string[] = [packageJson.module, "src/3d.ts", "src/testing.ts"]

// Build main entry points with code splitting
// External patterns to prevent bundling tree-sitter assets and default-parsers
// to allow standalone executables to work
const externalPatterns = [
...externalDeps,
"*.wasm",
"*.scm",
"./lib/tree-sitter/assets/*",
"./lib/tree-sitter/default-parsers",
"./lib/tree-sitter/default-parsers.ts",
]

// Build main entry points with code splitting
// Use --packages=external to externalize all dependencies
spawnSync(
"bun",
[
Expand All @@ -215,6 +210,7 @@ if (buildLib) {
"--splitting",
"--outdir=dist",
"--sourcemap",
"--packages=external",
...externalPatterns.flatMap((dep) => ["--external", dep]),
...entryPoints,
],
Expand All @@ -225,17 +221,15 @@ if (buildLib) {
)

// Build parser worker as standalone bundle (no splitting) so it can be loaded as a Worker
// Make web-tree-sitter external so it loads from node_modules with its WASM file
// Use --packages=external to externalize all dependencies
spawnSync(
"bun",
[
"build",
"--target=bun",
"--outdir=dist",
"--sourcemap",
...externalDeps.flatMap((dep) => ["--external", dep]),
"--external",
"web-tree-sitter",
"--packages=external",
"src/lib/tree-sitter/parser.worker.ts",
],
{
Expand Down
11 changes: 3 additions & 8 deletions packages/react/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ const distDir = join(rootDir, "dist")
rmSync(distDir, { recursive: true, force: true })
mkdirSync(distDir, { recursive: true })

const externalDeps: string[] = [
...Object.keys(packageJson.dependencies || {}),
...Object.keys(packageJson.peerDependencies || {}),
]

if (!packageJson.module) {
console.error("Error: 'module' field not found in package.json")
process.exit(1)
Expand All @@ -72,7 +67,7 @@ const mainBuildResult = await Bun.build({
entrypoints: [join(rootDir, packageJson.module)],
target: "bun",
outdir: join(rootDir, "dist"),
external: externalDeps,
packages: "external",
splitting: true,
})

Expand All @@ -86,7 +81,7 @@ const reconcilerBuildResult = await Bun.build({
entrypoints: [join(rootDir, "src/reconciler/renderer.ts")],
target: "bun",
outdir: join(rootDir, "dist/src/reconciler"),
external: externalDeps,
packages: "external",
splitting: true,
})

Expand All @@ -100,7 +95,7 @@ const testingBuildResult = await Bun.build({
entrypoints: [join(rootDir, "src/test-utils.ts")],
target: "bun",
outdir: join(rootDir, "dist/src/test-utils"),
external: externalDeps,
packages: "external",
splitting: true,
})

Expand Down
7 changes: 1 addition & 6 deletions packages/solid/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ const distDir = join(rootDir, "dist")
rmSync(distDir, { recursive: true, force: true })
mkdirSync(distDir, { recursive: true })

const externalDeps: string[] = [
...Object.keys(packageJson.dependencies || {}),
...Object.keys(packageJson.peerDependencies || {}),
]

if (!packageJson.module) {
console.error("Error: 'module' field not found in package.json")
process.exit(1)
Expand All @@ -73,7 +68,7 @@ const mainBuildResult = await Bun.build({
entrypoints: [join(rootDir, packageJson.module)],
target: "bun",
outdir: join(rootDir, "dist"),
external: externalDeps,
packages: "external",
plugins: [solidTransformPlugin],
splitting: true,
})
Expand Down
7 changes: 1 addition & 6 deletions packages/vue/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ const distDir = join(rootDir, "dist")
rmSync(distDir, { recursive: true, force: true })
mkdirSync(distDir, { recursive: true })

const externalDeps: string[] = [
...Object.keys(packageJson.dependencies || {}),
...Object.keys(packageJson.peerDependencies || {}),
]

if (!packageJson.module) {
console.error("Error: 'module' field not found in package.json")
process.exit(1)
Expand All @@ -71,7 +66,7 @@ const mainBuildResult = await Bun.build({
entrypoints: [join(rootDir, packageJson.module)],
target: "bun",
outdir: join(rootDir, "dist"),
external: externalDeps,
packages: "external",
// splitting: true,
})

Expand Down
Loading