geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
860 stars 181 forks source link

Error `Unexpected token: punc ()` #290

Closed muety closed 2 years ago

muety commented 2 years ago

I'm using geotiff.js as part of onaci/leaflet-geotiff-2 inside a Vue 2.x project and now get the following error when compiling.

js/chunk-edb17c18.8c64412d.js from Terser
Unexpected token: punc ()) [./node_modules/geotiff/dist-module/predictor.js:64,0][js/chunk-edb17c18.8c64412d.js:75,10]

ERROR  Build failed with errors.

This occurred after adding this import:

import { fromUrl } from 'geotiff'

The issue might also be caused downstream in the Leaflet plugin, but maybe someone here has got an idea?

muety commented 2 years ago

Never mind, that was caused because my Webpack was configured to transpile to ECMAScript 5, but skip external dependencies and since geotiff.js is apparently using ES6 code, things failed.