Gozala / Gozala/route.flow

incorrect ES6 module entry point

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Hi @Gozala,

I'm trying to use this library in the browser via webpack 3.
I'm unfortunately getting module parse errors when doing so:
```
Module parse failed: /Users/geekflyer/dev/NORAD/node_modules/route.flow/src/Route.js Unexpected token (3:12)
You may need an appropriate loader to handle this file type.
| /* @flow */
|
| import type { Concat } from "./Route/Concat"
| import type { float } from "float.flow"
| import type { integer } from "integer.flow"
```

The root cause is basically that in the package.json route.flow points to src/Route.js as ES6 module entry point https://github.com/Gozala/route.flow/blob/master/package.json#L17 .

However the code in `src/**` is actually not really ES6, because it still has the flow type annotations. Also note that I'm not using flow (I'm using typescript), hence there's no build step which can strip those annotations.
I think a proper way (and how other libraries do it) would be to let the build config create another directory `es6` which contains compiled resources which are ES6 compliant and then point the "module" property in package.json to that directory as entry point.

If you're intending to make this library only usable with flow (which would be kinda sad, because I think even without flow it's still better than other libs due to it's runtime type validation and casting and route composition), it would be good to add this limitation / warning to the docs :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.