Closed Catsvilles closed 3 years ago
Hey, the process
object could only available on the server-side. If you need to access some environment variable, you need to populate it through the sapper.middleware
in server.js
:
sapper.middleware({
session: (req, res) => ({
home: process.env.HOME
})
})
Then you can access it on the client-side with:
<script>
import { stores } from '@sapper/app';
const { session } = stores();
console.log($session.home)
</script>
I hope it helps.
Hey, thanks for getting back to me! There are so many reasons for this error actually, somehow I fixed it (not really sure how), after that I got many other errors but I guess I just have to pull through, Sapper is really unstable framework and every starter templates has it's own unique stuff we have to consider :)
Let's wait for SvelteKit! (I'm excited)
Hey, I'm trying to redesign my production Sappe app to Tailwind and need of a use of process in my comoponents, but for some reason I'm getting this error while with other starters I don't. Any idea what I messed up or need to setup? Thanks :)