This early experiment is now closed, as it is no longer up to date with developments at https://imba.io/
Use the Imba compiler (v2) to build *.imba
files from source using Vite.
mkdir sample
cd sample
npm init
npm install -D vite
npm install -D vite-plugin-imba
Create or edit vite.config.js
to add the vite-plugin-imba
plugin
import imbaPlugin from 'vite-plugin-imba';
export default {
plugins: [imbaPlugin()],
open: true,
optimizeDeps: {
exclude: ['imba'],
include: ['imba/src/imba/index'],
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Imba project</title>
</head>
<body>
<script type="module" src="./sample.imba"></script>
</body>
</html>
// use TABS to indent the code. Check how you save the source in your editor!
tag app-root
def render
<self>
<h1> "It works!"
imba.mount <app-root>
npx vite
npx vite build
HMR not working under Windows? (issue #735)
Patch this line in ./node_modules/vite/dist/node/server/serverPluginHtml.js
from
const importee = resolver.normalizePublicPath(utils_1.cleanUrl(slash_1.default(path_1.default.resolve('/', srcAttr[1] || srcAttr[2]))));
to
const importee = resolver.normalizePublicPath(utils_1.cleanUrl(slash_1.default(path_1.default.posix.resolve('/', srcAttr[1] || srcAttr[2]))));