Skip to content

Support sub path import, e.g. import { GetElementEvent } from "@ember-nexus/web-sdk/BrowserEvent/Element"; #80

@Syndesi

Description

@Syndesi

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementImproving existing functionalities.Help WantedSeeking community assistance.QuestionSeeking clarifications or information.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions