Skip to content

Usage with Nuxt 3 #46

@meister-eder

Description

@meister-eder

Hi, I'm trying to get your package to work with Nuxt 3.
I tried importing it in my nuxt.config.ts like this:

import { defineNuxtConfig } from 'nuxt3'

export default defineNuxtConfig({
    buildModules: [
        ['vue3-openlayers', '@pinia/nuxt', '@intlify/nuxt3', '@vueuse/core/nuxt']
    ],
    intlify: {
       // ...
},
    build: {
        // ...
    }
})

Which gives me this error on app startup

ERROR  Cannot start nuxt:  Cannot read property 'webpackJsonpvue3_openlayers' of undefined

  at module.exports.00ee (node_modules/vue3-openlayers/dist/vue3-openlayers.common.js:191:148)
  at node_modules/vue3-openlayers/dist/vue3-openlayers.common.js:203:9
  at g (node_modules/jiti/dist/jiti.js:1:55111)
  at requireModule (node_modules/@nuxt/kit/dist/index.mjs:86:26)
  at installModule (node_modules/@nuxt/kit/dist/index.mjs:1241:50)
  at initNuxt (node_modules/nuxt3/dist/index.mjs:905:11)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6713:9)
  at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6752:5)
  at async _main (node_modules/nuxi/dist/chunks/index.mjs:386:7)

When I place the import at the end of the buildModules array, the error disappears, but upon opening my testpage I receive the following errors:

[Vue warn]: Failed to resolve component: ol-map
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: ol-view
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: ol-tile-layer
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: ol-source-osm
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
Invalid value used as weak map key
  at WeakMap.set (<anonymous>)  
  at normalizePropsOptions (./node_modules/vue/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:2689:11)  
  at createComponentInstance (./node_modules/vue/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6115:23)  
  at renderComponentVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:197:22)  
  at Module.ssrRenderComponent (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:623:12)  
  at _sfc_ssrRender (file://./.nuxt/dist/server/server.mjs:4813:31)  
  at renderComponentSubTree (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:263:13)  
  at renderComponentVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:214:16)  
  at renderVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:304:22)  
  at renderVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:310:17)

Not sure if this is the right place to ask, but I'm stuck.
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions