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

Support dynamic import #102

Merged
merged 1 commit into from
Jan 26, 2018
Merged

Support dynamic import #102

merged 1 commit into from
Jan 26, 2018

Conversation

oligot
Copy link
Contributor

@oligot oligot commented Jan 25, 2018

dynamic import support has just landed in Rollup 0.55.0.
When testing a project that uses buble via rollup-plugin-buble, I noticed that it doesn't support dynamic import yet, resulting in the error

SyntaxError: Unexpected token in ...

Looking at the rollup source code, I see that they are using acorn-dynamic-import.
This pull request therefore adds the acorn-dynamic-import plugin as done in rollup itself so that buble is able to parse code that uses dynamic import.

I've also created a small test file that fails without these changes.
Let me know if it's enought or if I should write more tests.

dynamic import support has just landed in [Rollup 0.55.0](https://github.com/rollup/rollup/blob/master/CHANGELOG.md#upcoming-0550).
When testing a project that uses buble via rollup-plugin-buble, I
noticed that it doesn't support dynamic import yet, resulting in the
error

```
SyntaxError: Unexpected token in ...
```

Looking at the [rollup source code](https://github.com/rollup/rollup/blob/089c9e06190b894d766fc44571752fa91dc1eaa5/src/Graph.ts#L3), I see that they are using [acorn-dynamic-import](https://github.com/kesne/acorn-dynamic-import).
This pull request therefore adds the acorn-dynamic-import plugin as done in rollup
itself so that buble is able to parse code that uses dynamic import.

I've also created a small test file that fails without these changes.
Let me know if it's enought or if I should write more tests.
oligot added a commit to oligot/nodent-compiler that referenced this pull request Jan 25, 2018
[dynamic import](https://github.com/tc39/proposal-dynamic-import) support has just landed in [Rollup 0.55.0](https://github.com/rollup/rollup/blob/master/CHANGELOG.md#upcoming-0550).
When testing a project that uses nodent via [rollup-plugin-nodent](https://github.com/oligot/rollup-plugin-nodent), I noticed that it doesn't support dynamic import yet, resulting in the error

```
SyntaxError: Unexpected token in ...
```

Looking at the [rollup source code](https://github.com/rollup/rollup/blob/089c9e06190b894d766fc44571752fa91dc1eaa5/src/Graph.ts#L3), I see that they are using [acorn-dynamic-import](https://github.com/kesne/acorn-dynamic-import).
This pull request therefore adds the acorn-dynamic-import plugin as done in rollup itself so that the nodent compiler is able to parse code that uses dynamic import.

This is quite similar to what has been done for [buble](bublejs/buble#102).
oligot added a commit to oligot/rollup-plugin-nodent that referenced this pull request Jan 25, 2018
[dynamic import](https://github.com/tc39/proposal-dynamic-import) support has just landed in [Rollup 0.55.0](https://github.com/rollup/rollup/blob/master/CHANGELOG.md#upcoming-0550).
When testing a project that uses nodent via rollup-plugin-nodent, I noticed that it doesn't support dynamic import yet, resulting in the error

```
SyntaxError: Unexpected token in ...
```

Looking at the [rollup source code](https://github.com/rollup/rollup/blob/089c9e06190b894d766fc44571752fa91dc1eaa5/src/Graph.ts#L3), I see that they are using [acorn-dynamic-import](https://github.com/kesne/acorn-dynamic-import).
This patches the acorn version that is used in nodent to add the acorn-dynamic-import plugin as done in rollup itself.
That way, the nodent compiler is able to parse code that uses dynamic import.

This is quite similar to what has been done for [buble](bublejs/buble#102).

Also switch from xo to eslint and eslint-config/plugin-*
@adrianheine adrianheine merged commit 5f05fda into bublejs:master Jan 26, 2018
@adrianheine
Copy link
Member

Great, thanks for your contribution!

@oligot oligot deleted the dynamic-import branch January 26, 2018 14:27
@adrianheine adrianheine mentioned this pull request Feb 9, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants