FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
maxm
maxmlockfileImportMap
Public
Like
1
lockfileImportMap
Home
Code
2
README.md
S
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Lockfile Import Map

image.png

Use an import map to make sure your Val frontend and backend are always using the exact same versions.

We already track the versions of your https imports in the Deno lockfile. Now you can expose those on the frontend as well using an import map.

Use it like so:

Create val
import { lockfileImportMap } from "https://esm.town/v/maxm/lockfileImportMap" return new Response(` <script type="importmap">${lockfileImportMap()}</script> <script type="module" src="${import.meta.url}"></script> `, { headers: {"content-type": "text/html"}});

Here's an example app I made with townie: https://www.val.town/v/maxm/emojiTodoListApp

You can see that the "https://esm.sh/react" import imports the version directly without any redirects. Saving on network hops and also ensuring version stability!

Code
README.md
S
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.