Developing Building Nuxt ESLint FAQ - xkjyeah/vue-google-maps GitHub Wiki
UglifyJS is giving you errors
Symptom: Unexpected token: punc (() [./node_modules/vue2-google-maps/src/components/polygon.js:50,0]
Why this happens: vue2-google-maps
is distributed as a set of .vue
single-file components and are also written
in ES6. This allows you to use ES6+/ES7+ code, for example if you are only targeting more recent browsers, and also allows you to do fancy stuff like tree-shaking to reduce bundle size.
However, this also means that the files in node_modules/vue2-google-maps
also require transpilation. This is unusual
for a library.
For users of Nuxt.js or the default Vue CLI templates, this is a problem because Nuxt.js has an implicit configuration that turns off transpilation for files under node_modules
. Internally, Nuxt.js also disables transpilation for files loaded as libraries (e.g. require('vue2-google-maps')
instead of require('~/node_modules/vue2-google-maps/src/main.js')
).
Solution: (~
is an alias for the project root)
import * as VueGoogleMaps from '~/node_modules/vue2-google-maps/src/main'
References: