question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Workaround for custom webpack providers?

See original GitHub issue

I’m afraid that the answer for this will just be “eject” but I’ll ask anyways.

With an entry point like this:

// index.js
import 'jquery/dist/jquery.min.js';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/js/bootstrap.min.js';

You’ll get the error:

screen shot 2016-08-14 at 7 54 30 pm

For right now I have jQuery in my index.html, but believe this is fixed by providing something like the following in the webpack config:

  plugins: [
    new webpack.ProvidePlugin({
      $: "jquery",
      jQuery: "jquery"
    })
  ],

However I’d really like to avoid ejecting. Any thoughts?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Aug 29, 2016

If you want to avoid ejection, the best you can do is to create your own package that combines jquery with bootstrap and uses webpack to build them together with whatever configuration you need. You can then put this package on npm and use it from CRA project.

1reaction
eanplattercommented, Aug 15, 2016

Yeah I believe the current API calls for just using the index.html file for these kinds of things.

Might not be relevant to your use case, but it might make sense to use something like react-bootstrap which covers features like dropdowns without the use of jQuery as jQuery can be tricky to use with React.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ProvidePlugin - webpack
ProvidePlugin. Automatically load modules instead of having to import or require them everywhere. new webpack.
Read more >
How to configure custom webpack build for Angular 12 App
Since yesterday I am trying to customize webpack build for angular 12 app. I`ve struggled with a lot of errors for last couple...
Read more >
serverless-webpack/README.md at master - GitHub
This plugin is for you if you want to use the latest Javascript version with Babel; use custom resource loaders, optimize your packaged...
Read more >
Using Webpack with React, Pt. 1 - Toptal
If you want to maintain a greater degree of control over your build process, then you might choose to invest in a custom...
Read more >
Setup - Testing Library
Custom Render​. It's often useful to define a custom render method that includes things like global context providers, data stores, etc. To make ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found