Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customize "vue!" #22

Open
williamsharkey opened this issue Dec 20, 2017 · 4 comments
Open

customize "vue!" #22

williamsharkey opened this issue Dec 20, 2017 · 4 comments

Comments

@williamsharkey
Copy link

I found it slightly confusing when starting to use this library because the main app.js would require both Vue (the standard library) and vue (this project which is for requiring vue).

I was wondering if one may customize the name of "vue" to make it more obvious. For example, change:

  paths: {
    "Vue": "https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.1/vue",          //for dev
    "vue": "https://rawgit.com/edgardleal/require-vue/master/dist/require-vuejs",
  },

into:

  paths: {
    "Vue": "https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.1/vue",          //for dev
    "reqV": "https://rawgit.com/edgardleal/require-vue/master/dist/require-vuejs",
  },

So instead of using vue! you could use reqV!, if you prefer.

I tried this and it breaks require-vuejs. The error I see in my browser console:

require.js:968 Uncaught TypeError: Cannot read property 'normalize' of undefined
    at b.<anonymous> (require.js:968)
    at require.js:134
    at require.js:1189
    at each (require.js:59)
    at b.emit (require.js:1188)
    at b.check (require.js:938)
    at b.enable (require.js:1176)
    at b.init (require.js:788)
    at h (require.js:1203)
    at Object.completeLoad (require.js:1611)

Is there a reason why the name "vue!" shouldn't be customizable? Granite, I don't have much experience with require.js, and I don't know the "right" way to do things.

@edgardleal edgardleal self-assigned this Dec 20, 2017
@edgardleal
Copy link
Owner

I will work on it and tell you when it is ready.
Thank you again for your feedback.

@edgardleal
Copy link
Owner

Here is where i register the component vue
In your code you can do some thing like this:

Create a file named reqV.js :

define( ['vue'], function(plugin) {
      return plugin;
});

Now you can import your components using this code:

  define(["reqV!componentA", "reqV!componentB"], function(A, B) {

  });

This is not the better way to do this, but i will try to find some thing better.

@williamsharkey
Copy link
Author

Thanks, that gives me a better understanding. Also, don't feel obliged to work on this issue, it is not a huge deal. If I have some extra time I may work on it and send a pull request. I think this project is small enough that it should not be so difficult for outsiders to make contributions. Thanks again, Wm

@edgardleal
Copy link
Owner

Ok. Thanks !

@edgardleal edgardleal removed their assignment Dec 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants