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

rename AMD module definition to typeahead for requirejs compatability #1558

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nikcub
Copy link

@nikcub nikcub commented Aug 25, 2016

With the AMD module being defined as 'typeahead.js' requirejs configuration attempts to load the module from a relative file path since it assumes it is a file and not module reference.

For config to work with the module being loaded from the baseUrl require the .js extension to be removed from the AMD module definition.

Before:

requirejs.config({
  baseUrl: '/javascripts/',
  paths: {
    'typeahead.js': 'vendor/typeahead.js/dist/typeahead.jquery'
});

// Will attempt to load a file from ./typeahead.js 
require(['typeahead.js']);

renaming it doesn't work since the module is exported as typeahead.js

requirejs.config({
  baseUrl: '/javascripts/',
  paths: {
    'typeahead': 'vendor/typeahead.js/dist/typeahead.jquery'
});

// Won't load since the exported definition is typeahead.js 
require(['typeahead']);

Fixed version:

requirejs.config({
  baseUrl: '/javascripts/',
  paths: {
    'typeahead': 'vendor/typeahead/dist/typeahead.jquery'
});

// Loads
require(['typeahead']);

typeahead is already registered in bower so it will load correctly with nothing more than a definition name change

@nikcub
Copy link
Author

nikcub commented Aug 25, 2016

I only just saw #1438

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

lynnvaughan added a commit to Beanfield/typeahead.js that referenced this pull request Jul 29, 2019
danielhollas added a commit to KhanovaSkola/khanovaskola-v3 that referenced this pull request Mar 14, 2020
Could not update typehead to 0.11.1 because of:
twitter/typeahead.js#1558
Maybe we could use this fork:
https://github.com/nikcub/typeahead

But according to CHANGELOG, 0.11 was a major rewrite,
so I think we'll stay with the old version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants