marcvangend / gridsome-plugin-gtag

5 stars 0 forks source link

error when built in docker container #1

Closed njordr closed 4 years ago

njordr commented 4 years ago

Hi.

I just tried your plugin. Non problem if built utside of docker, but if I built it inside docker, I got the following error:

Initializing plugins...
/app/node_modules/gridsome-plugin-gtag/gridsome.server.js:3
  options.enabled = options.enabled ?? process.env.NODE_ENV === 'production'
                                     ^

SyntaxError: Unexpected token '?'
    at compileFunction (<anonymous>)

I'm a very noob at gridsome and all the entire environment: any advice?

Thanks

njordr commented 4 years ago

gridsome v0.7.14

marcvangend commented 4 years ago

Hi, sorry for the slow reply, I missed the notification.

I don't know which docker container you are using, but it probably doesn't use the latest Node.js version. The ?? in the code is called a nullish coalescing operator and it's a very recent addition to ECMAscript and has only been supported by Node.js since version 14. In other words: I should have avoided this operator until support is more wide-spread. Sorry for breaking your build.

marcvangend commented 4 years ago

@njordr The fix is available now. Thanks for your bug report. Any feedback is welcome.