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

Issue using bootstrap-3-typeahead in webpack #366

Open
dalanmiller opened this issue Jan 4, 2019 · 1 comment
Open

Issue using bootstrap-3-typeahead in webpack #366

dalanmiller opened this issue Jan 4, 2019 · 1 comment

Comments

@dalanmiller
Copy link

dalanmiller commented Jan 4, 2019

Currently have bootstrap-3-typeahead and jquery installed via npm:

npm i --save bootstrap bootstrap-3-typeahead jquery

Then import bootstrap-3-typeahead` in my main.js file:

import 'bootstrap';
import 'bootstrap/js/tooltip';
import 'bootstrap-3-typeahead';

Then in my webpack.config.js I have the following as bootstrap js requires jquery:

new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery',
      jquery: 'jquery',
    }),

However, I still get the following when trying to load my application:

bootstrap3-typeahead.js:29 Uncaught Error: Cannot find module 'jquery'
    at webpackMissingModule (bootstrap3-typeahead.js:29)
    ...

https://github.com/bassjobsen/Bootstrap-3-Typeahead/blob/master/bootstrap3-typeahead.js#L29

Am I missing something here?

@ajoslin103
Copy link

even with all that I still had to import jquery --after-- importing the plugin

// ref: https://github.com/bassjobsen/Bootstrap-3-Typeahead/
import 'bootstrap-3-typeahead';
import * as $ from 'jquery';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants