Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No marker after build to prod #953

Closed
BIhab opened this issue May 31, 2022 · 15 comments
Closed

No marker after build to prod #953

BIhab opened this issue May 31, 2022 · 15 comments

Comments

@BIhab
Copy link
Contributor

BIhab commented May 31, 2022

Describe the bug
After build the app to prod, no marker shown on the map. - works fine on prod -
I think the problem occurred when svg icons was moved from public to resources and it's related to the asset being static, not sure about that, not even sure if I'm not the only one facing that issue.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '/opt/traccar/traccar-web/modern'
  2. Execute 'npm run build_release'
  3. Connect to traccar in prod not using npm start
  4. No marker show in the map

Desktop (please complete the following information):

  • OS: [e.g. Ubuntu ]
  • Browser [Firefox, Chrome]

Smartphone (please complete the following information):
On mobile too

Even on docker

@tananaev
Copy link
Member

Have you checked browsers console for errors?

@BIhab
Copy link
Contributor Author

BIhab commented May 31, 2022

Have you checked browsers console for errors?

This error occurs :

ReferenceError: g is not defined

The error only show in prod, in local all work great, for that I'm not able to debugg better.

Can you please confirm if it is a general bug or a specific one?

@tananaev
Copy link
Member

@BIhab
Copy link
Contributor Author

BIhab commented May 31, 2022

Looks similar to this:

https://www.traccar.org/forums/topic/modern-build-from-source-and-deploy-y-is-not-defined/

I followed what will_ed suggested.
I installed node v18.2.0 tried to build with it - just to try if it'll work before using V16.15- , nothing changed.
Then Installed node v16.15.0 and tried to build with but also nothing changed.

It's really strange to get the error only in production, in your side, you can build the app and get the marker shown in the map?

@tananaev
Copy link
Member

Haven't tried release version yet.

@MaTyyyJ
Copy link

MaTyyyJ commented May 31, 2022

@BIhab @tananaev - "production": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ], in package.json fix this issue

@tananaev
Copy link
Member

That's not really a good solution. We want to support older browser versions as well, when possible.

@MaTyyyJ
Copy link

MaTyyyJ commented May 31, 2022

@tananaev
"production": [ "defaults", "not firefox < 55", "not chrome < 55", "not safari < 11", "not opera < 40", "not IE <= 11", "not op_mini all", "not dead" ],
something like this? this fix this too

@tananaev
Copy link
Member

Wonder if we can find where exactly it breaks. Is it some specific browser?

@BIhab
Copy link
Contributor Author

BIhab commented May 31, 2022

@BIhab @tananaev - "production": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ], in package.json fix this issue

I confirm that this workaround did the job, certainly it's not a a final solution but at least it guides us to the source of the problem

@MaTyyyJ
Copy link

MaTyyyJ commented May 31, 2022

@tananaev @BIhab - ES6?
image

"production": [ "defaults", "not ie 11" ],
fix this too (from maplibre/maplibre-gl-js#1011 (comment) )

@BIhab
Copy link
Contributor Author

BIhab commented May 31, 2022

@tananaev @BIhab - ES6? image

"production": [ "defaults", "not ie 11" ], fix this too (from maplibre/maplibre-gl-js#1011 (comment) )

I have a question out of the subject but it will be really helpful to me and to any one who want to collaborate in this project, how did you know that the problem was due to the browser support? I past the last 4 day trying to debug it without success.

@MaTyyyJ
Copy link

MaTyyyJ commented May 31, 2022

@BIhab - just look into package.json
"browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] },

if it works on development and not on production it means there must be a difference somewhere

@BIhab
Copy link
Contributor Author

BIhab commented May 31, 2022

@BIhab - just look into package.json "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] },

if it works on development and not on production it means there must be a difference somewhere

Feels like I lack on experience, I'll learned from you thanks a lot

@tananaev
Copy link
Member

tananaev commented Jun 1, 2022

Decided to go with this for now:

    "production": [
      "defaults",
      "not ie 11"
    ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants