dmnsgn/primitive-ellipsoid

Exported module is not transpiled and ES5 compatible

kevzettler opened this issue · 4 comments

primitive-ellipsoid/index.js

appears to be using default argument syntax and is failing to import into my project which isn't setup for this Ecmascript Feature.

The exported primitive-ellipsoid module in index.js should be transpired to generic ES

Uncaught Error: Module parse failed: /Users/kevzettler/code/crashgiants/node_modules/primitive-ellipsoid/index.js Unexpected token (8:4)
You may need an appropriate loader to handle this file type.
|   // Default to an oblate spheroid
|   const { latSegments = 32, lngSegments = 64, rx = 2, ry = 1, rz = 1 } = {
|     ...options
|   };
| 
    at Object../node_modules/primitive-ellipsoid/index.js (index.js:68)

Destructuring and default function parameters are available since Node 6: https://node.green/. Latest Node LTS is Node 10.

What are your use case and Node version?

I don't intend to add a build step for such a straightforward module.

@dmnsgn this error is coming from use in the browser when bundled with webpack

kevs-mbp:crashgiants kevzettler$ node -v
v8.11.4
kevs-mbp:crashgiants kevzettler$ npm -v
6.14.4

If the error is coming after bundle in a browser that doesn't handle the now standard syntax, then you want webpack to target the browsers you intend to support. The responsibility of compiling to your desired targets should be on your build system.