martinkr / next-export-i18n

Internationalize (18n) next.js with true support for next export
MIT License
247 stars 37 forks source link

Syntax Error: Unexpected Token '.' when deploying on DigitalOcean #24

Closed stichiboi closed 2 years ago

stichiboi commented 2 years ago

I'm trying to deploy on DigitalOcean as a static site. Locally, the npm run export works fine.

But the build on DO fails with the following error:

/workspace/node_modules/next-export-i18n/index.js:26
        window?.navigator) {
                    ^

 SyntaxError: Unexpected token '.'
     at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.341 (/workspace/.next/server/pages/index.js:163:51)
    at __webpack_require__ (/workspace/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/workspace/.next/server/pages/index.js:307:39) {
   type: 'SyntaxError'
 }

The app was created with npx create-next-app -ts I'm using versions:

    "next": "12.0.10",
    "next-export-i18n": "^1.4.1",

Do you have an idea on what is causing the error?

martinkr commented 2 years ago

Hi,

thank you for asking.

I have an idea, just not sure why it's happening. I will investigate this over the weekend. Until then, can you try verison 1.2.1? I'm pretty sure that this will work for you.

Cheers!

stichiboi commented 2 years ago

1.2.1 is indeed working Thank you!

martinkr commented 2 years ago

Hi stichiboi,

can you try next-export-i18n@1.4.2 ? I hope it's working now for you.

Cheers!

stichiboi commented 2 years ago

1.4.2 is indeed working! Thank you ❤️