Juan Ignacio Dopazo (2014-06-20T23:11:39.000Z)
On Friday, June 20, 2014 7:15 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote:
 
typo ...

```
var require = function (fromWhere) {
  return  import * from fromWhere
};
```

That's not valid ES6. It's specified that:

- Import and export statements can only be top level statements
- The module name must be a string literal.
- Import * is not specified.

ES6 modules are designed to be static. So no, you can't use import statements under the hood in require(). But you can set up things so that you can use "import" to import CommonJS modules.

Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140620/c69a0772/attachment-0001.html>
dignifiedquire at gmail.com (2014-06-21T08:55:57.123Z)
> On Friday, June 20, 2014 7:15 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote:
> 
> typo ...
>
> ```js
> var require = function (fromWhere) {
>   return  import * from fromWhere
> };
> ```

That's not valid ES6. It's specified that:

- Import and export statements can only be top level statements
- The module name must be a string literal.
- Import * is not specified.

ES6 modules are designed to be static. So no, you can't use import statements under the hood in `require()`. But you can set up things so that you can use `import` to import CommonJS modules.

Juan