https://github.com/xkjyeah/vue-google-maps/issues/73
upgrading from [email protected] to [email protected]
this error appeared again
https://github.com/xkjyeah/vue-google-maps/issues/73
client works but hitting a ssr route gives "SyntaxError: Unexpected token <"
no changes where made to nuxt.config.js
to work
"SyntaxError: Unexpected token <"
plugins/vueGoogleMaps.js
`
import Vue from 'vue'
import * as VueGoogleMaps from '~/node_modules/vue2-google-maps/src/main'
Vue.use(VueGoogleMaps, {
load: {
key: '
libraries: 'places,drawing,geometry,visualization',
},
})`
nuxt.config.js
plugins: [
{ src: '~/plugins/vueGoogleMaps', ssr: false }
],
tried to add externals but didn't work
build: {
extend(config, {isDev, isClient} ) {
if (!isClient) {
config.externals = []; // added for testing
config.externals.splice(0, 0, function (context, request, callback) {
if (/^vue2-google-maps($|\/)/.test(request)) {
callback(null, false)
} else {
callback()
}
})
}
}
}
Sry my first bug report hope i do it right!
Or should i report at vue2-google-maps ?
Please use build.transpile to include it into babel transpiling.
build: {
transpile: [
'vue2-google-maps'
]
}
Thank you!
Worked!
With @clarkdo solution, problem is still there.
TypeError
(0 , _mapElementFactory2.default) is not a function
WARNING Compiled with 2 warnings 23:42:41
warning in ./plugins/google-maps.js
"export 'default' (imported as 'GmapCluster') was not found in 'vue2-google-maps/dist/components/cluster'
warning in ./components/modals/order/order-map.vue?vue&type=script&lang=js&
"export 'gmapApi' was not found in 'vue2-google-maps'
try to remove it from transpile again.
using:
"nuxt-edge": "^2.0.0-25609473.c77fa47",
"vue2-google-maps": "^0.10.2",
in /plugins/vueGoogleMaps i changed also
import * as VueGoogleMaps from '~/node_modules/vue2-google-maps/src/main'
to
import * as VueGoogleMaps from 'vue2-google-maps'
also i removed all the
build: { extend .. thing
after these edits and rebuilding the project some weird webpack4 magic took place
and it worked again
@Krystus did you figure it out?
@mariojankovic just look at this.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Please use
build.transpileto include it into babel transpiling.