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

Npm package need update, which don't have esm format #6

Open
Gtanghaibo opened this issue Feb 20, 2021 · 3 comments
Open

Npm package need update, which don't have esm format #6

Gtanghaibo opened this issue Feb 20, 2021 · 3 comments

Comments

@Gtanghaibo
Copy link

No description provided.

@thespacedeck
Copy link

Hi there,

Running the library in Vue3 I get :
Uncaught SyntaxError: The requested module '/node_modules/map-promisified/dist/mapPromisify.js?v=ef5eaebc' does not provide an export named 'default'

<template>
  <div id="mapMain" ref="mapContainer" class="absolute top-0 bottom-0 left-0 right-0">
    <MglMap :accessToken="accessToken" />
  </div>
  <!-- <router-view /> -->
</template>

<script lang="ts">
import { computed, defineComponent, onMounted, reactive, ref } from "vue";

import Mapbox from "mapbox-gl";
import { MglMap } from "vue-mapbox";
export default defineComponent({
  components: { MglMap },
  setup() {
    const mapContainer = ref();
    const mapbox = ref(null);

    let accessToken = "pk.eyJ1IjoidHJvb3AiLCJhIjoiY2txdXNrcnMyMDducTJucnk4dmE0d2V1byJ9.CpmXTiNQDQGPzqQ6K2SfwQ";

    onMounted(() => {
      mapbox.value = Mapbox;
    });
    

    return { mapContainer, accessToken, mapbox };
  },
});
</script>

Your assistance is appreciated :)

@TheJoeSchr
Copy link

Same here, how can we workaround this?

Using it with vite and Vue3

@TheJoeSchr
Copy link

Ok, in my case I "fixed" it by putting this into vite.config.js

export default defineConfig({
  define: { "process.env": {} },
  plugins: [vue()],
  // added this -->
  optimizeDeps: {
    include: ['map-promisified']
  },
  // <-- added this 
}

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