SyntaxError: Unexpected token import (from flow-runtime)
- Dominant language
- JavaScript
- Stars
- 797
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
This is a:
- [x] Bug Report
- [x] Question
Which concerns:
- [x] flow-runtime
- [x] babel-plugin-flow-runtime
---
### What is the current behaviour?
**The complete configuration is here**: https://github.com/OKNoah/flow-runtime-test
package.json
```json
{
"presets": [
"stage-2",
"react"
],
"plugins": [["flow-runtime"], "transform-decorators-legacy"]
}
```
index.js
```js
// @flow-runtime
type User = {
name: string
};
console.log('henlo')
```
```bash
[nodemon] starting `node -r babel-register index.js`
/Users/noah/Projects/flow-runtime-test/index.js:1
(function (exports, require, module, __filename, __dirname) { import t from 'flow-runtime';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at loader (/Users/noah/Projects/flow-runtime-test/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/noah/Projects/flow-runtime-test/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
[nodemon] app crashed - waiting for file changes before starting...
```
---
### What is the expected behaviour?
Should compile without errors and console log.
---
### Which package versions are you using?
```
"babel": "^6.23.0",
"babel-plugin-flow-runtime": "^0.15.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.26.0",
"flow-runtime": "^0.16.0"
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.