Last active
September 15, 2019 07:02
-
-
Save antony/255a4a68e7823773d1c2dad5df6fcfea to your computer and use it in GitHub Desktop.
Configuration variables in Svelte / Sapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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