peterqliu / threebox

A three.js plugin for Mapbox GL JS, with support for basic animation and advanced 3D rendering.
MIT License
528 stars 320 forks source link

fix SyntaxError: Unexpected token static when building #64

Open RELNO opened 5 years ago

RELNO commented 5 years ago

Problem

Upon packing for production (using parcel.js/webpack) an error occurred: SyntaxError: Unexpected token static

Description

This error is caused since the word static is misinterpreted by terser optimization module during build for prod (but won't raise during testing). See: https://medium.com/@omril321/fixing-overly-aggressive-optimization-with-terser-f07309761b50 Probably due to static methods changeing in ES6/7

Solution

Replace variable static with staticVal where it is used

Results

Build is succesful