Skip to content

Export renderer and Renderer based on environment from @b9g/crank/standalone #256

Open
@brainkim

Description

@brainkim

It’s annoying to import the new jsx template tag from standalone, and also have to import a renderer for the respective environment. I’m wondering if we can use some sort of environment detection mechanism to have the correct one imported.

Before:

import {jsx} from "@b9g/crank/standalone";
import {renderer} from "@b9g/crank/dom";

renderer.render(jsx`<div id="hello">Hello world</div>`, document.body);

After:

import {jsx, renderer} from "@b9g/crank/standalone";

renderer.render(jsx`<div id="hello">Hello world</div>`, document.body);

How do we determine environment? I don’t like using non-standard package.json exports, and exports conditions are really confusing. I honestly just want to do top-level await imports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions