RangerMauve / dat-archive-web

DatArchive implementation for browsers that uses dat-gateway
MIT License
30 stars 4 forks source link

Use in VUE CLI app - TypeError: Cannot read property 'match' of undefined #6

Closed RobertoSnap closed 5 years ago

RobertoSnap commented 6 years ago

Goal

Setup node-dat-archive and use it from a browser with dat-archive-web

Steps

  1. node-dat-archive running locally.
  2. Createn VUE application with npm install -g @vue/cli npm install --save dat-archive-web vue create dat-test
  3. Change ./src/views/home.vue
    
    <template>
    <div class="home">
    <img alt="Vue logo" src="../assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App"/>
    </div>
    </template>

3. Run it in development mode   ``` npm run serve```

## Error 
[https://i.imgur.com/D5VKM4M.png](https://i.imgur.com/D5VKM4M.png)
polyfills.js?a0a3:32 Uncaught TypeError: Cannot read property 'match' of undefined
    at patch (polyfills.js?a0a3:32)
    at patch (graceful-fs.js?0da7:58)
    at Object.eval (graceful-fs.js?0da7:27)
    at eval (graceful-fs.js:264)
    at Object../node_modules/graceful-fs/graceful-fs.js (app.js:3522)
    at __webpack_require__ (app.js:768)
    at fn (app.js:131)
    at eval (index.js?bf81:4)
    at Object../node_modules/pauls-dat-api/node_modules/fs-extra/lib/fs/index.js (app.js:5068)
    at __webpack_require__ (app.js:768)

## Fiddle

Tried recreating it in FiddleJs but did not manage

[Fiddle](https://jsfiddle.net/RAHP/50wL7mdz/762908/)
RangerMauve commented 6 years ago

I think the problem is that the polyfill is expecting the page to be loaded from a gateway, since you're probably loading off of localhost, it's throwing an error. Try specifying a DEFAULT_DAT_GATEWAY global variable pointing to the gateway you want to use. Mak sure it's defined before you load the polyfill.

RobertoSnap commented 6 years ago

I think the problem is that the polyfill is expecting the page to be loaded from a gateway, since you're probably loading off of localhost, it's throwing an error. Try specifying a DEFAULT_DAT_GATEWAY global variable pointing to the gateway you want to use. Mak sure it's defined before you load the polyfill.

Tried this, but had no effect. You can close the issue, im will try it another time with something simple.

RangerMauve commented 5 years ago

Dang! Sorry to hear that it didn't work out. 🙁

wangge63 commented 4 years ago

Is this problem solved?

RangerMauve commented 4 years ago

@FuPingstar I suggest checking out the Dat SDK instead. Specifically the latest version being worked on in this branch