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

Map not showing on release build #167

Closed
woshikie opened this issue Oct 22, 2020 · 8 comments
Closed

Map not showing on release build #167

woshikie opened this issue Oct 22, 2020 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@woshikie
Copy link
Contributor

woshikie commented Oct 22, 2020

As per title.
Tested on the following App.vue:

<template>
  <div id="app">
    <MglMap class="mglmap" container="map" :zoom="10.5" :access-token="accessToken" :map-style="mapStyle" :center="sgCenter">
      <MglGeolocateControl/>
      <MglNavigationControl/>
    </MglMap>
  </div>
</template>

<script>
import 'mapbox-gl/dist/mapbox-gl.css';
import 'v-mapbox/dist/v-mapbox.css';
import '@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css';
import {MglMap, MglNavigationControl, MglGeolocateControl} from 'v-mapbox'
export default {
  name: 'App',
  components: {MglMap, MglNavigationControl, MglGeolocateControl},
  data(){
    return {
      accessToken: '<omitted>',
      mapStyle: 'mapbox://styles/mapbox/dark-v9',
      sgCenter: [103.82161, 1.35433],
    };
  }
}
</script>
<style scoped>
.mglmap {
  height: 100vh;
  position: absolute;
  z-index: 0;
}
</style>

map works on npm run serve, npm run build --mode development but not on npm run build

Edit: Changed test code

@vinayakkulkarni
Copy link
Owner

- import {MglMap, MglNavigationControl, MglGeolocateControl} from 'vue-mapbox'
+ import { MglMap, MglNavigationControl, MglGeolocateControl } from 'v-mapbox'

seems you're importing the wrong package

@woshikie
Copy link
Contributor Author

Updated test code with suggestion. Still unable to see the map on release build

@vvavepacket
Copy link

@vinayakkulkarni I'm also facing the same issue. New release build. And map is not loading...

@vvavepacket
Copy link

@vinayakkulkarni
I'm seeing 100% width and height being occupied, but still map is blank. Do you have some samples where you tested this with latest build? I appreciate your help

image

@vinayakkulkarni
Copy link
Owner

@vvavepacket: can you reproduce this with a demo repo or codesandbox?

@woshikie
Copy link
Contributor Author

@vinayakkulkarni
Copy link
Owner

@woshikie & @vvavepacket: I've fixed some minor issues, released a new version & have done a demo on codesandbox.

Edit v-mapbox-map-demo

@vinayakkulkarni vinayakkulkarni self-assigned this Oct 29, 2020
@vinayakkulkarni vinayakkulkarni added the bug Something isn't working label Oct 29, 2020
@woshikie
Copy link
Contributor Author

woshikie commented Oct 29, 2020

Thanks for the update @vinayakkulkarni

I have updated my repo with the latest package and this is the output from my npm run build.

dist.zip

You can see for yourself that the map is not showing. It is showing, however, on debug builds, which we can see on CodeSandbox or npn run serve

If you don't have a development web server to run the files, you can use python as a web server.
Assuming you are using python 3 and you extracted the zip file to your current working directory:
python -m http.server --directory dist
You should be able to reach your python web server on http://localhost:8000 (by default)

Edit: not opening a new issue as we can simply reopen this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants