mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-21 14:05:08 +00:00
run sirv in dev-mode in “development” env
This commit is contained in:
@@ -4,13 +4,16 @@ import sapper from 'sapper';
|
|||||||
import compression from 'compression';
|
import compression from 'compression';
|
||||||
import { manifest } from './manifest/server.js';
|
import { manifest } from './manifest/server.js';
|
||||||
|
|
||||||
|
const { PORT, NODE_ENV } = process.env;
|
||||||
|
const dev = NODE_ENV === 'development';
|
||||||
|
|
||||||
polka() // You can also use Express
|
polka() // You can also use Express
|
||||||
.use(
|
.use(
|
||||||
compression({ threshold: 0 }),
|
compression({ threshold: 0 }),
|
||||||
sirv('assets'),
|
sirv('assets', { dev }),
|
||||||
sapper({ manifest })
|
sapper({ manifest })
|
||||||
)
|
)
|
||||||
.listen(process.env.PORT)
|
.listen(PORT)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log('error', err);
|
console.log('error', err);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user