tagify icon indicating copy to clipboard operation
tagify copied to clipboard

Vue 2.7 compilation error when building application

Open szafran98 opened this issue 3 years ago • 8 comments

Hey,

after upgrading Vue from 2.6.14 to 2.7.5 I'm having a problem with build as in the screenshot.

image

How can I make it working again? I didn't do any code changes except changing Vue version.

szafran98 avatar Jul 13 '22 08:07 szafran98

What loader... why does it complain.. this is a Webpack issue it seems, not Vue

yairEO avatar Jul 13 '22 14:07 yairEO

Closing as OP is non-responsive and the issue is vague and also I don't know Vue

yairEO avatar Jul 20 '22 20:07 yairEO

Hmm getting this error on @yaireo/[email protected] with [email protected].

The error is:

 ERROR  in ./node_modules/@yaireo/tagify/dist/tagify.min.js                                                                                                                                                               friendly-errors 22:57:45

Module parse failed: Unexpected token (26:30620)                                                                                                                                                                          friendly-errors 22:57:45
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

Rolled back to @yaireo/[email protected] and everything seems fine again.

hansy avatar Jul 22 '22 03:07 hansy

Can you please create a Codesandbox basic example so I could examine?

yairEO avatar Jul 23 '22 11:07 yairEO

I have the same issue in a Gulp/Browserify setup, starting with v4.13. All versions below v4.13 don‘t have that issue, so right now I‘m sticking with v4.12.

I‘ll try to provide a minimal example as soon as possible.

mrcgrtz avatar Aug 02 '22 21:08 mrcgrtz

@mrcgrtz - Gulp + Vue? Since when does Vue compiles with Gulp?

yairEO avatar Aug 03 '22 08:08 yairEO

@yairEO Sorry, I should have been more specific: No, this is not happening in a Vue codebase.

But this might be an issue with some dependency along the way, like Terser, Uglify etc. which both Vue and my setup share. I have a TypeScript module importing Tagify which gets transpiled using Browserify and Gulp.

With v4.13 I get a [SyntaxError]: Unexpected token: punc (.) while parsing file: /some_project/node_modules/@yaireo/tagify/dist/tagify.min.js while with v4.12 everything’s running smooth.

But as I said, I’ll create a minimal example as soon as I have some spare time.

mrcgrtz avatar Aug 03 '22 15:08 mrcgrtz

At which point do you get this error? it does not state any line... you can use the unminified version of Tagify and replace your tagify.min.js in node_modules with that, and then you'll see exactly which line is causing it

yairEO avatar Aug 04 '22 07:08 yairEO

@yairEO This is the same issue as I had. Babel isn't setup correct to use optional chaining. Which you added in 4.13 it seems?

breakerh avatar Aug 12 '22 16:08 breakerh

I don't remember when did I add optional-chaining but your babel setup must be very old if it does not support that, which means you should update it regardless of Tagify, which is only one symptom. I also advise you to install Browserlist and configure it in your package.json file

yairEO avatar Aug 13 '22 08:08 yairEO

For the sake of completeness: I could pinpoint my issue with the unexpected token down to the minifier which uses an outdated version of terser that could not handle the optional chaining added to v4.13’s dist files.

I already had the latest version of @babel/preset-env and a sensible .browserslistrc file, so I now use the latest terser directly and everything’s smooth again.

So no issue with this package apparently, sorry for the false alarm.

Maybe this helps other people when searching for this issue.

mrcgrtz avatar Aug 22 '22 11:08 mrcgrtz