Skip to content

Instantly share code, notes, and snippets.

@antony
Last active Sep 15, 2019
Embed
What would you like to do?
Configuration variables in Svelte / Sapper
import conf from 'config'
const appConfig = Object.keys(conf).reduce((acc, n) => {
acc[`process.env.${n}`] = JSON.stringify(conf[n])
return acc
}, {})
export default {
client: {
...,
plugins: [
...
replace({
'process.browser': true,
'process.env.NODE_ENV': JSON.stringify(mode),
...appConfig
}),
...
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment