Supporting sub path imports would not only look nicer, but will likely make tree shaking etc. easier to realize.
Furthermore the current workaround is more verbose:
Variant A:
import * as EmberNexus from "@ember-nexus/web-sdk";
const event = new EmberNexus.BrowserEvent.Element.GetElementEvent(
EmberNexus.Type.Definition.validateUuidFromString("2d3cec20-6311-4bec-9626-9c04458e91dd")
);
Variant B:
import * as EmberNexus from "@ember-nexus/web-sdk";
const { GetElementEvent } = EmberNexus.BrowserEvent.Element;
const { validateUuidFromString } = EmberNexus.Type.Definition;
const event = new GetElementEvent(
validateUuidFromString("2d3cec20-6311-4bec-9626-9c04458e91dd")
);
But ideally it should something like this:
import { GetElementEvent } from "@ember-nexus/web-sdk/BrowserEvent/Element";
import { validateUuidFromString } from "@ember-nexus/web-sdk/Type/Definition";
const event = new GetElementEvent(
validateUuidFromString("2d3cec20-6311-4bec-9626-9c04458e91dd")
);
It should technically be possible to support such a use case, although in reality it turns out to be non trivial in every scenario.
The key aspects are, that this library uses type="module" within its package.json, and it as well as other Ember Nexus web projects are using moduleResolution="bundler".
The following articles might provide additional context:
Supporting sub path imports would not only look nicer, but will likely make tree shaking etc. easier to realize.
Furthermore the current workaround is more verbose:
Variant A:
Variant B:
But ideally it should something like this:
It should technically be possible to support such a use case, although in reality it turns out to be non trivial in every scenario.
The key aspects are, that this library uses
type="module"within itspackage.json, and it as well as other Ember Nexus web projects are usingmoduleResolution="bundler".The following articles might provide additional context: