Skip to content

Commit 166fb26

Browse files
ndbroadbentclaude
andcommitted
Use Bun text imports for map templates
Replace Vite's ?raw imports with Bun's `with { type: 'text' }` syntax. Rename template files to .template extension to avoid conflict with Bun's built-in HTMLBundle type for .html files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5ec4299 commit 166fb26

File tree

8 files changed

+9
-19
lines changed

8 files changed

+9
-19
lines changed

src/export/map/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import type { GeocodedActivity, MapConfig } from '../../types'
88
import { generateListOnlyHTML } from '../map-list-html'
9-
import APP_JS from './app.js?raw'
9+
import APP_JS from './app.js.template' with { type: 'text' }
1010
import { toMapData } from './data'
1111
import { generateMapHTML } from './template'
1212
import type { MapData } from './types'

src/export/map/raw-imports.d.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/export/map/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* Generates the HTML shell that loads data.js and app.js.
55
*/
66

7-
import HTML_TEMPLATE from './index.html?raw'
8-
import MAP_STYLES from './styles.css?raw'
7+
import HTML_TEMPLATE from './index.html.template' with { type: 'text' }
8+
import MAP_STYLES from './styles.css.template' with { type: 'text' }
99

1010
/**
1111
* Generate the HTML template.

src/text-imports.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Type declarations for Bun's text imports using `with { type: 'text' }`
2+
declare module '*.template' {
3+
const content: string
4+
export default content
5+
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"noUncheckedIndexedAccess": true,
2424
"exactOptionalPropertyTypes": true
2525
},
26-
"include": ["src/**/*.ts", "tests/**/*.ts"],
26+
"include": ["src/**/*.ts", "src/**/*.d.ts", "tests/**/*.ts"],
2727
"exclude": ["node_modules", "dist"]
2828
}

0 commit comments

Comments
 (0)