Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

put server assets in subfolder #455

Merged
merged 2 commits into from
Oct 1, 2018
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
2 changes: 1 addition & 1 deletion src/api/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
Expand Down
6 changes: 4 additions & 2 deletions src/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down
2 changes: 1 addition & 1 deletion src/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion test/common/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down