put server assets in subfolder

This commit is contained in:
Rich Harris
2018-10-01 15:21:35 -04:00
parent 0826a58995
commit d9ad1d1b10
3 changed files with 7 additions and 5 deletions

View File

@@ -58,7 +58,7 @@ prog.command('build [dest]')
process.env.PORT = process.env.PORT || ${opts.port || 3000}; process.env.PORT = process.env.PORT || ${opts.port || 3000};
console.log('Starting server on port ' + process.env.PORT); console.log('Starting server on port ' + process.env.PORT);
require('./server.js'); require('./server');
`.replace(/^\t+/gm, '').trim()); `.replace(/^\t+/gm, '').trim());
console.error(`\n> Finished in ${elapsed(start)}. Type ${colors.bold.cyan(`node ${dest}`)} to run the app.`); console.error(`\n> Finished in ${elapsed(start)}. Type ${colors.bold.cyan(`node ${dest}`)} to run the app.`);

View File

@@ -24,12 +24,14 @@ export default {
server: { server: {
input: () => { input: () => {
return `${locations.src()}/server.js` return {
index: `${locations.src()}/server.js`
};
}, },
output: () => { output: () => {
return { return {
dir: locations.dest(), dir: `${locations.dest()}/server`,
format: 'cjs', format: 'cjs',
sourcemap: dev() sourcemap: dev()
}; };

View File

@@ -23,13 +23,13 @@ export default {
server: { server: {
entry: () => { entry: () => {
return { return {
server: `${locations.src()}/server` index: `${locations.src()}/server`
}; };
}, },
output: () => { output: () => {
return { return {
path: locations.dest(), path: `${locations.dest()}/server`,
filename: '[name].js', filename: '[name].js',
chunkFilename: '[hash]/[name].[id].js', chunkFilename: '[hash]/[name].[id].js',
libraryTarget: 'commonjs2' libraryTarget: 'commonjs2'