Merge pull request #89 from sveltejs/remove-start-dev
remove start:dev, put serve plugin in config file
This commit is contained in:
commit
bcc87d1db2
3 changed files with 20 additions and 17 deletions
|
@ -16,7 +16,6 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup -c",
|
"build": "rollup -c",
|
||||||
"dev": "rollup -c -w",
|
"dev": "rollup -c -w",
|
||||||
"start": "sirv public --single",
|
"start": "sirv public --single"
|
||||||
"start:dev": "sirv public --single --dev"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import resolve from 'rollup-plugin-node-resolve';
|
||||||
import commonjs from 'rollup-plugin-commonjs';
|
import commonjs from 'rollup-plugin-commonjs';
|
||||||
import livereload from 'rollup-plugin-livereload';
|
import livereload from 'rollup-plugin-livereload';
|
||||||
import { terser } from 'rollup-plugin-terser';
|
import { terser } from 'rollup-plugin-terser';
|
||||||
import rollup_start_dev from './rollup_start_dev';
|
|
||||||
|
|
||||||
const production = !process.env.ROLLUP_WATCH;
|
const production = !process.env.ROLLUP_WATCH;
|
||||||
|
|
||||||
|
@ -37,9 +36,9 @@ export default {
|
||||||
}),
|
}),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
|
|
||||||
// In dev mode, call `npm run start:dev` once
|
// In dev mode, call `npm run start` once
|
||||||
// the bundle has been generated
|
// the bundle has been generated
|
||||||
!production && rollup_start_dev,
|
!production && serve(),
|
||||||
|
|
||||||
// Watch the `public` directory and refresh the
|
// Watch the `public` directory and refresh the
|
||||||
// browser on changes when not in production
|
// browser on changes when not in production
|
||||||
|
@ -53,3 +52,20 @@ export default {
|
||||||
clearScreen: false
|
clearScreen: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function serve() {
|
||||||
|
let started = false;
|
||||||
|
|
||||||
|
return {
|
||||||
|
writeBundle() {
|
||||||
|
if (!started) {
|
||||||
|
started = true;
|
||||||
|
|
||||||
|
require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
|
||||||
|
stdio: ['ignore', 'inherit', 'inherit'],
|
||||||
|
shell: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,12 +0,0 @@
|
||||||
import * as child_process from 'child_process';
|
|
||||||
|
|
||||||
let running_dev_server = false;
|
|
||||||
|
|
||||||
export default {
|
|
||||||
writeBundle() {
|
|
||||||
if (!running_dev_server) {
|
|
||||||
running_dev_server = true;
|
|
||||||
child_process.spawn('npm', ['run', 'start:dev'], { stdio: ['ignore', 'inherit', 'inherit'], shell: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Reference in a new issue