A lightning-fast frontend build tool designed to leverage JavaScript's native ESM system for unbundled development with instant browser updates.
82
Build a development server configuration that handles multiple routing scenarios for a static site with API mocking capabilities.
Your task is to create a Snowpack configuration file that handles the following routing requirements:
API Proxy Route: All requests to /api/* should be proxied to https://jsonplaceholder.typicode.com/* (where * represents the remaining path)
SPA Fallback: All requests that don't match existing files and don't start with /api should fall back to /index.html to support client-side routing
Static Asset Rewriting: Requests to /assets/* should be served from the /public/* directory
Custom 404 Handler: Requests to paths starting with /docs/ that don't exist should be redirected to /docs/index.html
@generates
Create a snowpack.config.js file that implements these routing rules. The configuration should work with Snowpack's development server.
// Export a configuration object with appropriate route settings
module.exports = {
// Your configuration here
};/api/users/1 proxies to https://jsonplaceholder.typicode.com/users/1 @test/about (non-existent file) serves /index.html for SPA routing @test/assets/logo.png serves /public/logo.png @test/docs/missing-page redirects to /docs/index.html @testProvides development server and routing capabilities.
Install with Tessl CLI
npx tessl i tessl/npm-snowpackevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10