Opinionated frontend compiler in browser.
- Bundle in browser for rapid prototyping
- Resolve modules by
https://esm.sh - Transpile
typescript
- Create virtual fs by
rollup-plugin-virtual-fs - Load npm modules via
rollup-plugin-http-resolve - Compile with
typescript - Compile with
rollup
npm install uniroll typescript rollup --save
import { bundle } from "uniroll";
const files = {
"/foo.tsx": "export default 1",
"/index.tsx": "import foo from 'foo';\nconsole.log('hello', foo)",
};
const bundled = await bundle({
files,
input: "/index.tsx",
});
const out = await bundled.generate({ format: "esm" });
console.log(out.output[0]);Run compiler with same logics.
$ npm install uniroll-tools -g
$ uniroll foo.js -o out.jsTODO: Options Documentation
# If you are not on MacOS try running `yarn --ignore-platform` instead of `yarn install`.
yarn install
yarn build
yarn testyarn add uniroll typescript rollup
# If you want to use uniroll-svelte, add svelteAdd this wepback rules
module.exports = {
// ...
module: {
rules: [
// ...
{
test: /\.js$/,
include: /pluginutils/, // for @rollup/pluginutils
type: "javascript/auto",
},
],
},
};- Drop
rollup-plugin-memfsand add newrollup-plugin-virtual-fs - Use
https://esm.sh
- Use
typescriptcompiler instead of@babel/coreand dorp babel plugins. - No more
useInMemory: trueoption. Just takefsormemfs. - Drop
package.jsonreading. UseimportmapsWICG/import-maps: How to control the behavior of JavaScript imports
- Documentation
- CSS Loader / Optimizer
- Svelte usages
- include tslib
MIT
- Kotaro Chikuba ~ @mizchi