lasso-js / lasso

Advanced JavaScript module bundler, asset pipeline and optimizer
580 stars 75 forks source link

using spread operator `...` and any word including the substring `process` throws unexpected token error due to regex in lasso #294

Open vinzloh opened 5 years ago

vinzloh commented 5 years ago

The error:

image

Happens when using the spread operator ... and any word that has the substring process. Lasso's inspect uses regex that targets process (even in comments, this error happens)

Our workaround is to use Object.assign just for this file that we need input.processingFee :)

Sharing in case anyone else has faced this obscure issue. saves some hours.

vinzloh commented 5 years ago

also happens to require, meaning I cannot import modules into the component.js part of Marko :(

DylanPiercey commented 5 years ago

Lasso only supports shipped js features. We use esprima to parse JavaScript and you can track their issue here although again they usually only include stage 4 features.

If you want to use features not yet stable in JS you will need to transpile them using Babel, there is a lasso plugin for this here which should do what you want with the appropriate Babel config.