Background info
We have a React app already configured and working with webpack.
This app has already a jquery dependency:
“jquery”: “3.4.1”,
That jquery is both exposed with expose-loader and loaded with ProvidePlugin:
module: {
rules: [
…
{
test: require.resolve(“jquery”),
loader: “expose-loader”,
options: {
exposes: ["$", “jQuery”],
},
…
]
},
plugins: [
…
new webpack.ProvidePlugin({
$: “jquery”,
jQuery: “jquery”,
}),
]
When adding the okta-sign-widget, webpack fails to build.
Seems an error related to conflicts in the jQuery version and we can’t find a way to fix this
Expected behavior
That we can add and use signin widget with webpack without any major problem
What went wrong?
Webpack error log
[0] TypeError: r.default.ajaxSetup is not a function
[0] at Object.call (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\node_modules@okta\courage\src\util\jquery-wrapper.js:4:1)
[0] at webpack_require (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\webpack\bootstrap f7e6bda01b7d30b21656:19:1)
[0] at Object.call (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\node_modules@okta\courage\src\models\SchemaProperty.js:2:1)
[0] at webpack_require (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\webpack\bootstrap f7e6bda01b7d30b21656:19:1)
[0] at Object.call (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\node_modules@okta\courage\src\models\BaseSchema.js:4:1)
[0] at webpack_require (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\webpack\bootstrap f7e6bda01b7d30b21656:19:1)
[0] at Object.call (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\src\CourageForSigninWidget.js:3:1)
[0] at webpack_require (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\webpack\bootstrap f7e6bda01b7d30b21656:19:1)
[0] at Object.call (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\okta-sign-in.entry.js:6696:20)
[0] at t (C:\MyApp\node_modules@okta\okta-signin-widget\dist\js\webpack:\webpack:\webpack\bootstrap f7e6bda01b7d30b21656:19:1)
Steps to reproduce
If the current behavior is a bug, please provide the steps to reproduce and a minimal demo if possible (you can use this template as a starting point: Edit fiddle - JSFiddle - Code Playground).
Your environment
- Okta Sign-In Widget Version: tried 5.5.0 and 5.7.0
- Browser: all
- OS: Windows 10
- Language: English