Skip to content

Commit

Permalink
app.cjs (#362)
Browse files Browse the repository at this point in the history
* app.js should be app.cjs, until everything becomes ESM

* changeset
  • Loading branch information
Rich Harris authored Feb 2, 2021
1 parent 6b7ad47 commit b6c2434
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-tools-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

app.js -> app.cjs
2 changes: 1 addition & 1 deletion packages/kit/src/api/adapt/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function prerender({ dir, out, log, config, force }) {
const seen = new Set();

const server_root = resolve_path(dir);
const app = require(`${server_root}/server/app.js`);
const app = require(`${server_root}/server/app.cjs`);

app.init({
paths: config.paths
Expand Down
6 changes: 3 additions & 3 deletions packages/kit/src/api/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ export async function build(config) {
dir: `${OPTIMIZED}/server`,
format: 'cjs', // TODO some adapters might want ESM?
exports: 'named',
entryFileNames: '[name].js',
chunkFileNames: 'chunks/[name].js',
assetFileNames: 'assets/[name].js',
entryFileNames: '[name].cjs',
chunkFileNames: 'chunks/[name].cjs',
assetFileNames: 'assets/[name].cjs',
sourcemap: true
});

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/api/start/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const mutable = (dir) =>

export function start({ port, config }) {
return new Promise((fulfil) => {
const app = relative('./.svelte/build/optimized/server/app.js');
const app = relative('./.svelte/build/optimized/server/app.cjs');

const static_handler = fs.existsSync(config.files.assets)
? mutable(config.files.assets)
Expand Down

0 comments on commit b6c2434

Please sign in to comment.