[Modern] - Build from source and deploy - "Y is not defined"

Will_ed3 years ago

When building the modern app from source and deploying to our webserver I get the error in the screenshot, this happens with latest source code before any changes. This means no marks or tracks are shown on the track and appears to stop locationIQ streets loading, ZXY maps are fine but without marks or tracks.

No issues when running development server using 'npm start', this only happens when running 'npm build_release' and uploading to live version - traccar server is also running current source code.

screenshot

Node 16.15.0

Anton Tananaev3 years ago

Have you tried development mode with your production server as backend?

Will_ed3 years ago

Development mode of modern interface connected to production server backend works as expected.

Anton Tananaev3 years ago

Weird. That would probably indicate in the React tools. Have you tried clearing the browser cache?

Will_ed3 years ago

Cleared the cache and tried on a clean machine I will try building on a different machine as well.

Anton Tananaev3 years ago

Just tried the release version and don't have any errors.

Will_ed3 years ago

I'm not sure then, I've tried building on a clean ubuntu 20.04 install downloaded the zip from github instead of git clone:

using node 16.15.0
npm install
npm run build_release

Upload to production server and same issue, it seems to be documented as an issue in mapbox and occasionally in maplibre, have tried this fix with no help but not sure why we are having a different result to you?

MapLibre and React

Anton Tananaev3 years ago

I'm also not sure. I'm using Mac with Node v18.2.0. Maybe try newer Node and NPM?

Will_ed3 years ago

Have tried with v18.2.0 as well with the same issue, agree it must be something in the build process as it works on development mode on the production server but can't understand why we get different results.

Will_ed3 years ago

Strangely npm install with v18 then npm build_release with v16 works fine...