Merge branch 'master' into patch-1
This commit is contained in:
commit
8f5737d9aa
5 changed files with 23 additions and 4 deletions
|
@ -33,6 +33,8 @@ npm run dev
|
|||
|
||||
Navigate to [localhost:5000](http://localhost:5000). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.
|
||||
|
||||
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host 0.0.0.0`.
|
||||
|
||||
|
||||
## Deploying to the web
|
||||
|
||||
|
@ -47,6 +49,7 @@ npm install -g now
|
|||
Then, from within your project folder:
|
||||
|
||||
```bash
|
||||
cd public
|
||||
now
|
||||
```
|
||||
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
"name": "svelte-app",
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"npm-run-all": "^4.1.5",
|
||||
"rollup": "^1.12.0",
|
||||
"rollup-plugin-commonjs": "^10.0.0",
|
||||
"rollup-plugin-livereload": "^1.0.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-svelte": "^5.0.3",
|
||||
"rollup-plugin-terser": "^4.0.4",
|
||||
"rollup-plugin-terser": "^5.1.2",
|
||||
"svelte": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -16,8 +15,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"autobuild": "rollup -c -w",
|
||||
"dev": "run-p start:dev autobuild",
|
||||
"dev": "rollup -c -w",
|
||||
"start": "sirv public --single",
|
||||
"start:dev": "sirv public --single --dev"
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import resolve from 'rollup-plugin-node-resolve';
|
|||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import livereload from 'rollup-plugin-livereload';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import rollup_start_dev from './rollup_start_dev';
|
||||
|
||||
const production = !process.env.ROLLUP_WATCH;
|
||||
|
||||
|
@ -36,6 +37,10 @@ export default {
|
|||
}),
|
||||
commonjs(),
|
||||
|
||||
// In dev mode, call `npm run start:dev` once
|
||||
// the bundle has been generated
|
||||
!production && rollup_start_dev,
|
||||
|
||||
// Watch the `public` directory and refresh the
|
||||
// browser on changes when not in production
|
||||
!production && livereload('public'),
|
||||
|
|
12
rollup_start_dev.js
Normal file
12
rollup_start_dev.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
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 });
|
||||
}
|
||||
}
|
||||
};
|
|
@ -5,6 +5,7 @@
|
|||
<style>
|
||||
h1 {
|
||||
color: purple;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
Loading…
Reference in a new issue