Skip to content

Handle wildcard imports: import * as something from '@ember/something' #16

@buschtoens

Description

@buschtoens

emberjs/ember-cli-babel#170 (comment)

The import statement supports importing all named exports into an object.

For example, instead of this

import {
 alias as computedAlias,
 and as computedAnd,
 // ...
} from '@ember/object/computed';
import { decoratedPropertyWithRequiredParams } from '../utils/decorator-macros';

export const alias = decoratedPropertyWithRequiredParams(computedAlias);

you could just do this

import * as computed from '@ember/object/computed';
import { decoratedPropertyWithRequiredParams } from '../utils/decorator-macros';

export const alias = decoratedPropertyWithRequiredParams(computed.alias);

But apparently, the latter does not work. 🙁

Could not find module `@ember/object/computed` imported from `ember-decorators/object/computed`

emberjs/ember-cli-babel#170 (comment)

We would need to handle wildcard import in babel-plugin-ember-modules-API-polyfill. This seems reasonable to me though. We would need to check if the specified module contains only exports from a single namespace or multiple. If multiple namespaces we would have to build up the intermediate POJO that would be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions