summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/snowpack/astro/pages/news.hmx8
-rw-r--r--examples/snowpack/snowpack.config.js7
2 files changed, 11 insertions, 4 deletions
diff --git a/examples/snowpack/astro/pages/news.hmx b/examples/snowpack/astro/pages/news.hmx
index cdccace95..f1350ed3f 100644
--- a/examples/snowpack/astro/pages/news.hmx
+++ b/examples/snowpack/astro/pages/news.hmx
@@ -9,7 +9,8 @@
import news from '../data/news.json';
import users from '../data/users.json';
- export function setup({ context, request }) {
+ export async function setup({ context, request, fetch }) {
+ const pokemonData = await fetch(`https://pokeapi.co/api/v2/pokemon/ditto`);
return {
context: {
title: 'Community & News',
@@ -18,6 +19,7 @@
// Add your project, organization, or company to the end of this list!
news,
users,
+ pokemonData: await pokemonData.json(),
}
}
}
@@ -37,6 +39,10 @@
<a href="https://github.com/snowpackjs/snowpack/edit/main/www/_data/news.js">Submit it!</a>
</p>
+ <p>
+ In case you're curious, the best pokemon is <strong>{context.pokemonData.name}.</strong>
+ </p>
+
<div class="card-grid card-grid-3">
<article class="discord-banner">
<a href="https://discord.gg/snowpack" style="flex-shrink: 0; height: 48px;"><img alt="Join us on Discord!"
diff --git a/examples/snowpack/snowpack.config.js b/examples/snowpack/snowpack.config.js
index 5cab1aaa0..b67784ba1 100644
--- a/examples/snowpack/snowpack.config.js
+++ b/examples/snowpack/snowpack.config.js
@@ -1,5 +1,6 @@
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
+
mount: {
public: '/',
//src: '/_dist_',
@@ -12,9 +13,9 @@ module.exports = {
'@snowpack/plugin-vue'
],
packageOptions: {
- // Blocked by CSS asset support
- // source: 'remote',
- // types: true,
+ external: [
+ 'node-fetch'
+ ]
},
devOptions: {
// Eleventy updates multiple files at once, so add a 1000ms delay before we trigger a browser update