diff --git a/src/api/export.ts b/src/api/export.ts index e136398b1..9b9fa4603 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -71,7 +71,7 @@ async function execute(emitter: EventEmitter, opts: Opts) { message: `Crawling ${root.href}` }); - const proc = child_process.fork(path.resolve(`${opts.build}/server.js`), [], { + const proc = child_process.fork(path.resolve(`${opts.build}/server/server.js`), [], { cwd: process.cwd(), env: Object.assign({ PORT: port, diff --git a/src/cli.ts b/src/cli.ts index de702b76c..e44e5d317 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -58,7 +58,7 @@ prog.command('build [dest]') process.env.PORT = process.env.PORT || ${opts.port || 3000}; console.log('Starting server on port ' + process.env.PORT); - require('./server.js'); + require('./server/server.js'); `.replace(/^\t+/gm, '').trim()); console.error(`\n> Finished in ${elapsed(start)}. Type ${colors.bold.cyan(`node ${dest}`)} to run the app.`); diff --git a/src/rollup.ts b/src/rollup.ts index 3910f936a..8dd591ead 100644 --- a/src/rollup.ts +++ b/src/rollup.ts @@ -24,12 +24,14 @@ export default { server: { input: () => { - return `${locations.src()}/server.js` + return { + server: `${locations.src()}/server.js` + }; }, output: () => { return { - dir: locations.dest(), + dir: `${locations.dest()}/server`, format: 'cjs', sourcemap: dev() }; diff --git a/src/webpack.ts b/src/webpack.ts index 6fc0ccbbe..c3424e0c6 100644 --- a/src/webpack.ts +++ b/src/webpack.ts @@ -29,7 +29,7 @@ export default { output: () => { return { - path: locations.dest(), + path: `${locations.dest()}/server`, filename: '[name].js', chunkFilename: '[hash]/[name].[id].js', libraryTarget: 'commonjs2' diff --git a/test/common/test.js b/test/common/test.js index 1291be65a..644b0338f 100644 --- a/test/common/test.js +++ b/test/common/test.js @@ -184,7 +184,7 @@ function run({ mode, basepath = '' }) { assert.ok(fs.existsSync('__sapper__/build/index.js')); } - proc = require('child_process').fork(`${dir}/server.js`, { + proc = require('child_process').fork(`${dir}/server/server.js`, { cwd: process.cwd(), env: { NODE_ENV: mode,