Workaround for custom webpack providers?
See original GitHub issueI’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](https://cloud.githubusercontent.com/assets/9126138/17653872/f1e884da-6258-11e6-827c-3f62f5b45e33.png)
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:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you want to avoid ejection, the best you can do is to create your own package that combines
jquery
withbootstrap
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.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.