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

Unexpected token in MathUtil.js #15

Closed
jelmervdl opened this issue Sep 2, 2018 · 7 comments
Closed

Unexpected token in MathUtil.js #15

jelmervdl opened this issue Sep 2, 2018 · 7 comments

Comments

@jelmervdl
Copy link

Hi,

When trying to include the react-geo module, the build breaks on an unexpected token in MathUtil.js. The static variables are not being accepted. When I convert them to true static methods, they compile as expected.

Node v10.8.0, after creating a react app via yarn create react-app my-app.

(The same happens in MapUtil.js of the ol-util module by the way. I can create pull requests for both if appreciated 😄 )

@marcjansen
Copy link
Member

AFAICT this is because we publish ES6 modules on npm which aren't understood by CRA. Ping @KaiVolland, correct? Can we publish ES5 additionally? Can you link to your remarks wrt ejecting etc.? TIA

@marcjansen
Copy link
Member

I think this is related: terrestris/react-geo#851 (comment)

@marcjansen
Copy link
Member

@jelmervdl If there is something we can do on our side to make this usable for e.g. CRA and still publish valid ES6, I'd say PRs very much welcome. A notice on the readme might also help in the meantime. Thanks in advance.

@KaiVolland
Copy link
Member

We might shoukld switch to ES5. Seems to cause a lot of problems.

@marcjansen
Copy link
Member

As we have just discussed, please try to provide a solution with ES6 and ES5 next to each other.

@annarieger
Copy link
Member

A possible solution to avoid transpiling error in CRA based projects is to force including of affected dependencies to be used with babel-loader in webpack config file like

{
    test: /\.(js|jsx|mjs)$/,
    include: [
        paths.appSrc,    
        path.resolve(paths.appNodeModules, '@terrestris/base-util'),
        path.resolve(paths.appNodeModules, '@terrestris/ol-util')
        [...]
    ],
    loader: require.resolve('babel-loader'),
    options: {...},
},

s. also facebook/create-react-app#1125 (comment)

This fixed the failing build of CRA app in some another project for me.

@dnlkoch
Copy link
Member

dnlkoch commented Oct 26, 2018

As of version 0.1.2 we publish both ES5 and ES6 modules so this issue should be resolved.

@dnlkoch dnlkoch closed this as completed Oct 26, 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

No branches or pull requests

5 participants