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

Fix intro guide #15247

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

Conversation

rafJagCode
Copy link
Contributor

Fixes intro guide error "invalid instaceof window.jquery"

Changes in client/vue.config.js

  const webpackPlugins = [
+    new webpack.ProvidePlugin({'window.jQuery': 'jquery'}),
    new webpack.DefinePlugin(envObject),
    new webpack.ContextReplacementPlugin(/moment[\\/]locale$/, /^\.\/(NOT_EXISTING)$/),
  ];

Error code: https://gist.github.com/rafJagCode/609d8773dc553cdfad9d4cb50ecc4124
Error img before fix and intro guide displayed after providing window.jquery:


UUID: 01148fda-c7f3-4668-a83d-e519eaf9407c

@CuriousMagpie
Copy link
Member

@SabreCat Can you review this? Thanks!

@negue
Copy link
Member

negue commented Jun 14, 2024

This is awesome! I've encountered this issue a couple of times but never found any clue how to fix that, and here you are with a fix 👏 👏 well done!!

@SabreCat LGTM and tested locally 🎉

@rafJagCode
Copy link
Contributor Author

@negue Thanks, your comment made my day.
Taking this opportunity, I'll explain what happened here, as it might help in deciding whether my solution is the most appropriate. The problem is with the intro.js module. Despite the fact that it uses jQuery, it doesn't include it as a peerDependency and doesn't import jQuery in its files, it simply assumes that window.jQuery will be available on the page. Adding jQuery in webpack.ProvidePlugin results in webpack automatically importing jQuery in the modules that use it during the build.

@negue
Copy link
Member

negue commented Jun 15, 2024

What I find weird is that this issue is only while in dev mode, on the production build this jquery issue never happens

I don't see any reason not to use your fix, one issue less to see while working in dev mode ^^

@rafJagCode
Copy link
Contributor Author

@nague In production, this error also occurs, and the introduction is not showing. It's just that in production mode, runtime errors are not displayed on the screen, but you will see the same error in the console. This error, of course, disappears when you have unlocked all guide steps.

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

Successfully merging this pull request may close these issues.

4 participants