Skip to content

Commit 7d8ce35

Browse files
Vicb (#2)
worker assets
1 parent b439dfe commit 7d8ce35

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

TODO.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
- wrangler alias
66
- move the wrangler.toml to the templates
7-
- figure out the assets
87
- dependency graph
98

109
DONE:
1110

11+
- figure out the assets
1212
- copy the template folders
1313

1414
## Install:
@@ -32,7 +32,7 @@ export default nextConfig;
3232

3333
- add "node-url": "npm:url@^0.11.4" to the package.json
3434

35-
- add a wrangler.tom int the generated app
35+
- add a wrangler.toml int the generated app
3636

3737
```
3838
#:schema node_modules/wrangler/config-schema.json
@@ -66,11 +66,11 @@ pnpm --filter builder build:watch
6666
Build the next app once:
6767

6868
```
69-
node /path/to/poc-next/builder/dist/index.mjs && wrangler dev
69+
node /path/to/poc-next/builder/dist/index.mjs && npx wrangler dev
7070
```
7171

7272
Then you can skip building the next app
7373

7474
```
75-
SKIP_NEXT_APP_BUILD=1 node /path/to/poc-next/builder/dist/index.mjs && wrangler dev
75+
SKIP_NEXT_APP_BUILD=1 node /path/to/poc-next/builder/dist/index.mjs && npx wrangler dev
7676
```

builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
"tsup": "^8.2.4",
1717
"typescript": "^5.5.4"
1818
}
19-
}
19+
}

builder/src/build/build-worker/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,13 @@ export async function buildWorker(
101101
updateWebpackChunksFile(nextjsAppPaths);
102102

103103
console.log(`\x1b[35m⚙️ Copying asset files...\n\x1b[0m`);
104-
await cp(`${nextjsAppPaths.dotNextDir}/static`, `${outputDir}/assets/_next`, {
105-
recursive: true,
106-
});
104+
await cp(
105+
`${nextjsAppPaths.dotNextDir}/static`,
106+
`${outputDir}/assets/_next/static`,
107+
{
108+
recursive: true,
109+
}
110+
);
107111

108112
console.log(`\x1b[35mWorker saved in \`${workerOutputFile}\` 🚀\n\x1b[0m`);
109113
}
@@ -187,4 +191,4 @@ function createFixRequiresESBuildPlugin(templateDir: string): Plugin {
187191
}));
188192
},
189193
};
190-
};
194+
}

builder/src/build/build-worker/patches/investigated/patchUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Hopefully this should not be necessary after this unenv PR lands: https://github.com/unjs/unenv/pull/292
66
*/
77
export function patchUrl(code: string): string {
8-
console.log("# patchUrl");
8+
console.log("# patchUrl");
99
return code.replace(
1010
/ ([a-zA-Z0-9_]+) = require\("url"\);/g,
1111
` $1 = require("url");

builder/src/build/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ export async function build(
2424
if (!opts.skipBuild) {
2525
// Build the next app and save a copy in .save.next
2626
buildNextjsApp(inputNextAppDir);
27-
rmSync(`${inputNextAppDir}/${SAVE_DIR}`, {
28-
recursive: true,
29-
force: true,
30-
});
27+
rmSync(`${inputNextAppDir}/${SAVE_DIR}`, {
28+
recursive: true,
29+
force: true,
30+
});
3131
cpSync(`${inputNextAppDir}/.next`, `${inputNextAppDir}/${SAVE_DIR}`, {
3232
recursive: true,
3333
});

next/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
"node-url": "npm:url@^0.11.4",
2525
"wrangler": "3.76.0"
2626
}
27-
}
27+
}

0 commit comments

Comments
 (0)