Skip to content

Commit

Permalink
[fix] Work around vite bug (#7088)
Browse files Browse the repository at this point in the history
Work around vite transform bug
  • Loading branch information
Rich-Harris authored Sep 29, 2022
1 parent 99929ad commit 4f603ad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-horses-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Work around SSR transform bug
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { invalid } from '@sveltejs/kit';
import { answers, allowed } from './words.server';
import { words, allowed } from './words.server';
import type { PageServerLoad, Actions } from './$types';

/** @type {import('./$types').PageServerLoad} */
Expand Down Expand Up @@ -88,12 +88,12 @@ class Game {
this.guesses = guesses ? guesses.split(' ') : [];
this.answers = answers ? answers.split(' ') : [];
} else {
this.index = Math.floor(Math.random() * answers.length);
this.index = Math.floor(Math.random() * words.length);
this.guesses = ['', '', '', '', '', ''];
this.answers = /** @type {string[]} */ [] /***/;
}

this.answer = answers[this.index];
this.answer = words[this.index];
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** The list of possible answers */
export const answers = [
/** The list of possible words */
export const words = [
'aback',
'abase',
'abate',
Expand Down Expand Up @@ -2317,9 +2317,9 @@ export const answers = [
'zonal'
];

/** The list of valid guesses, of which the list of possible answers is a subset */
/** The list of valid guesses, of which the list of possible words is a subset */
export const allowed = new Set([
...answers,
...words,
'aahed',
'aalii',
'aargh',
Expand Down

0 comments on commit 4f603ad

Please sign in to comment.