diff --git a/packages/create-blits/boilerplate/ts/default/src/App.ts b/packages/create-blits/boilerplate/ts/default/src/App.ts
index f471d6f8..849442a3 100644
--- a/packages/create-blits/boilerplate/ts/default/src/App.ts
+++ b/packages/create-blits/boilerplate/ts/default/src/App.ts
@@ -1,12 +1,11 @@
import Blits from '@lightningjs/blits'
-import Home from './pages/Home.js'
+import Home from './pages/Home'
export default Blits.Application({
template: `
-
- `,
+ `,
routes: [{ path: '/', component: Home }],
})
diff --git a/packages/create-blits/boilerplate/ts/default/src/index.ts b/packages/create-blits/boilerplate/ts/default/src/index.ts
index 49f45587..e400c62a 100644
--- a/packages/create-blits/boilerplate/ts/default/src/index.ts
+++ b/packages/create-blits/boilerplate/ts/default/src/index.ts
@@ -1,5 +1,5 @@
import Blits from '@lightningjs/blits'
-import App from './App.js'
+import App from './App'
Blits.Launch(App, 'app', {
w: 1920,
diff --git a/packages/create-blits/boilerplate/ts/default/src/pages/Home.ts b/packages/create-blits/boilerplate/ts/default/src/pages/Home.ts
index 2f268305..06c246f8 100644
--- a/packages/create-blits/boilerplate/ts/default/src/pages/Home.ts
+++ b/packages/create-blits/boilerplate/ts/default/src/pages/Home.ts
@@ -1,6 +1,6 @@
import Blits from '@lightningjs/blits'
-import Loader from '../components/Loader.js'
+import Loader from '../components/Loader'
const colors = ['#f5f3ff', '#ede9fe', '#ddd6fe', '#c4b5fd', '#a78bfa']
@@ -38,8 +38,7 @@ export default Blits.Component('Home', {
/>
-
- `,
+ `,
state() {
return {
/**
diff --git a/vite/blitsFileConverter.js b/vite/blitsFileConverter.js
index efae87b8..fda3e75f 100644
--- a/vite/blitsFileConverter.js
+++ b/vite/blitsFileConverter.js
@@ -16,23 +16,52 @@
*/
import blitsfileconverter from '../src/lib/blitsfileconverter/blitsfileconverter.js'
+import path from 'node:path'
+import fs from 'node:fs'
+import { createRequire } from 'module'
export default function blitsFileType() {
return {
name: 'vite-plugin-blits-file-type',
enforce: 'pre',
- transform(src, id) {
+
+ resolveId(source, importer) {
+ if (source.endsWith('.blits')) {
+ return importer ? path.resolve(path.dirname(importer), source) : path.resolve(source)
+ }
+ return null
+ },
+
+ load(id) {
if (id.endsWith('.blits')) {
- try {
- const transformedCode = blitsfileconverter(src)
- return {
- code: transformedCode,
- map: null, // no source map
+ const source = fs.readFileSync(id, 'utf-8')
+ let code = blitsfileconverter(source)
+
+ // Check for TypeScript and transpile to JS if needed
+ if (/