ember-cli / ember-cli/babel-plugin-ember-modules-api-polyfill

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

未关闭
#16 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
15
派生
19
PR 合并指标
30 天内没有已合并 PR

描述

https://github.com/babel/ember-cli-babel/issues/170#issue-246272427

> The [`import` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) supports importing all named exports into an object.
>
>For example, instead of this
>
>```js
>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
>
> ```js
> 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. :slightly_frowning_face:
>
> ```
> Could not find module `@ember/object/computed` imported from `ember-decorators/object/computed`
> ```

https://github.com/babel/ember-cli-babel/issues/170#issuecomment-318635180
> 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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先跟踪 Babel 插件如何处理 Ember 模块导入,然后阅读链接的 ember-cli-babel issue 和评论。这项工作应使 `import * as something from '@ember/something'` 能够正确解析,包括具有一个或多个导出命名空间的模块;完成的标准是文档中的通配符示例不再报告 module-not-found 错误。

由索引模型根据 Issue 内容生成。

评估

技术栈
babel, javascript
领域
tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。