Module parse failed: Unexpected token ? Optional chaining not recognised in threejs svgloader.js

Viewed 21

I have just upgraded to the latest threejs and am making use of the SVGLoader.js module. this previously worked and i'm now getting a compiler error:

Module parse failed: Unexpected token (2110:113) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

The line that is causing the error is below

// check if path is solid or a hole
const isAHole = simplePaths.map( p => isHoleTo( p, simplePaths, scanlineMinX, scanlineMaxX, shapePath.userData?.style.fillRule ) );

Its the optional chaining "?" after userData that is the problem. If i remove this it builds fine. This is a valid js feature so why is it not recognised?

Project details: vue with vuetify using typescript

0 Answers
Related