Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

eulores/vite-plugin-imba

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unmaintained

This early experiment is now closed, as it is no longer up to date with developments at https://imba.io/

vite-plugin-imba

Use the Imba compiler (v2) to build *.imba files from source using Vite.

Quick start

Create a sample directory and download the plugin

mkdir sample
cd sample
npm init
npm install -D vite
npm install -D vite-plugin-imba

vite.config.js

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'],
  }
}

Create some source files

./index.html

<!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>

./sample.imba

// 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>

Start developing your application.

npx vite

Create a production build in ./dist

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]))));

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published