B
B
beduin012016-01-09 18:04:57
JavaScript
beduin01, 2016-01-09 18:04:57

Is it possible to do without NodeJS and npm?

I came across the fact that this module https://github.com/vuejs/vue-resource
required `require` to work, which, as it turned out, comes with Webpack/Browserify and needs to be installed via npm.
Given that I know very little JS, I would like some simpler option. Is it possible to do without all this?
Any option that would work at least somehow will suit me. Preferably as easy as possible.
And another question. If I have this code:

var App = new Vue ({
   el: '#app',
  // template: '<usermenu></usermenu>',
  data:
    {
      currentView: 'foo'
    }
  })

Then to me:
var Vue = require('vue');

Vue.use(require('vue-resource'));

Should I leave it like that or do I need to modify it somehow? Just var Vue obviously needs to be linked to var App

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
Yuri Grinev, 2016-01-09
@linakun

You just connect like this after connecting Vue.js:
And you use

A
Alexander Litvinenko, 2016-01-09
@edli007

require is not a package, it's the basic construction of a node... but it's not entirely clear from the description what is required

I
index0h, 2016-01-09
@index0h

Is it possible to do without all this?

Of course you can. Only you will have to do the work of the package manager manually. This is the road to nowhere.

P
pomeo, 2016-01-09
@pomeo

Browserify is a simple thing, source.js would have done everything
themselves

var Vue = require('vue');
Vue.use(require('vue-resource'));

var App = new Vue ({
  el: '#app',
  // template: '<usermenu></usermenu>',
  data: { currentView: 'foo' }
})

Here is your finished app.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question