-
Notifications
You must be signed in to change notification settings - Fork 175
Require intro.js #71
Comments
It was done as part of an AMD Loading pull request, see here: #49 You shouldn't have to manually install intro.js, if you did a bower install you'd get it along with. |
I think the main issue was the name of intro.js. It was looking for a package named |
….js') which is the real name of the npm package
After change intro -> intro.js, loading using requirejs is dead. |
@banny310 can you make a quick demo showcasing this? |
BTW, @banny310 was right. This doesn't work with requirejs. One solution for me was to change the amd section from "intro.js" to "intro". This worked for me after I took the normal step of configuring a path for the "intro" module id. Though this does force me to use the module id of "intro" (which is fine).
I traced deep into where you had define(["angular", "intro.js"], factory). It leads to a requirejs assumption that if the .js is on the end of the dependency name, it uses it verbatim as the url (the filename). Normally with requirejs, I would add the paths as I want, using the module id as a reference to the actual path (filename). For example This is in require.js (v 2.3.2, line 1637. Note the "ends with .js" comment):
I hope that's helpful. I haven't found another way around this in the few hours I've put in. I don't know the etiquette around posting to a closed thread... but I hope you find this helpful. |
I had it closed, because I thought it was resolved, I'll check your solution and get a environment using requirejs, thanks for the feedback :) |
BTW, I copy the full & min files I need from node_modules into a "thirdparty" directory for deployment. Note that I modify the angular-intro JS files during the copy. So I'm happy with my hack, but I'm sure you'll find a real solution in the meantime :-)
Glad to provide the feedback. Thanks for the help. |
@aadhoc i'm currently making some tests on requirejs. i'm feeling strange change the name from "intro.js" to "intro". i feel more comfortable to "introJs" as it's the same as the object that we use, what do you think about it? |
Yes, module names are a bit inconsistent, with dashs, dots and even "js", ".js", "-js" suffixes. These are examples of a few of the stranger directory names, but the filenames are still pretty standard:
The emergent standard across these and the modules without strange suffixes would be Since you are trying to decide on what to call the module you're including, you can choose anything, but you'll need to make it obvious to the developers since they will need to (or already have) included it in their requirejs "paths". I currently have mine defined as 'intro', but you can call yours whatever you want. In the end it definitely doesn't matter, but don't include the dot. |
Hello! i did make a beta version on > https://github.com/mendhak/angular-intro.js/releases/tag/v4.0.0-beta changing the name of the module. hope this helps 😄 |
Hi! Is it gonna be on npm soon? Thanks |
+1 |
I'm using webpack and require to handle dependencies. I was finally able to get it working by changing
angular-intro.js
to the following:That is, with
intro.js
, instead ofintro
for the linedefine(["angular", "intro.js"], factory);
and requiring like so:
require('angular-intro.js)
I also had to manually install intro.js via npm.
Is there a reason why the code is requiring intro as opposed to intro.js? How can I get it to work without augmenting the library code? Thank you for your time!
The text was updated successfully, but these errors were encountered: