Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
buschtoens opened this issue Jul 28, 2017 · 1 comment

Comments

@buschtoens
Copy link

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.

@blimmer
Copy link

blimmer commented Aug 28, 2018

👍 - found this today because of this:

Using `import * as [object Object] from 'jquery'` is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants