beyonk-group / svelte-mapbox

MapBox Map and Autocomplete components for Svelte (or Vanilla JS)
MIT License
342 stars 62 forks source link

Importing component results in: TypeError: Cannot read property 'replace' of undefined #11

Closed socmag closed 4 years ago

socmag commented 4 years ago

Hey there,

I'm trying to give your component a whirl...

When I try to start my app, I'm getting this error when I import your component.

I'm new to Svelte, Snowpack and rollup, so probably something I'm doing wrong.

Any clues?

Thanks a lot!

Snowpack

  Server starting…

  mount:web_modules.......[READY] mount $WEB_MODULES --to /web_modules
  mount:public............[READY] mount public --to /
  mount:src...............[READY] mount src --to /_dist_
  build:js,jsx,ts,tsx.....[READY] (default) esbuild
  build:svelte............[READY] (plugin) @snowpack/plugin-svelte

▼ Console

  [log] ! updating dependencies...
  [error] 
  TypeError: Cannot read property 'replace' of undefined
      at Object.onwarn (/home/xyz/dev/maptest/node_modules/snowpack/dist-node/index.js:1924:37)
      at Object.config.onwarn.warning [as onwarn] (/home/xyz/dev/maptest/node_modules/rollup/dist/shared/rollup.js:18930:20)
      at Object.warn (/home/xyz/dev/maptest/node_modules/rollup/dist/shared/rollup.js:17974:25)
      at Object.resolveId (/home/xyz/dev/maptest/node_modules/snowpack/dist-node/index.js:939:14)
      at Promise.resolve.then (/home/xyz/dev/maptest/node_modules/rollup/dist/shared/rollup.js:18134:25)
antony commented 4 years ago

I'm afraid I've never used the module with snowpack, so I can't say if there are or aren't any issues you'll encounter.

Make sure you've installed it as a dev dependency, of course.

socmag commented 4 years ago

Thanks a lot Antony, yup, I did install it as a dev dependency.

I made it work for now by copying the files from node_modules into my project ¯\_(ツ)_/¯

In case you are ever curious to try, this is the starter template I used.

Anyway fine for now :)

and cheers, it's very nice!!