-
Notifications
You must be signed in to change notification settings - Fork 479
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
Switchery error in webpack #120
Comments
Are you sure that's not something on your side? There's no such method in this library. If you're certain it's a problem with Switchery though, please provide detailed steps of reproducing the issue and we'll take a look at it. Thanks! |
Seeing the same issue. Somehow |
I had this issue too, I came up with this solution using the string-replace-loader: module.exports = {
// ...
module: {
loaders: [
{
test: /switchery\.js$/,
loader: 'string-replace',
query: {
search: 'function FastClick(layer) {',
replace: 'function FastClick(layer) {_fastClick.call(window,layer);};function _fastClick(layer){'
}
}
]
}
} This will make the FastClick function to have the window context (this = window). An alternative solution would be to use the imports-loader to disable the module, exports and define variables within the Switchery module definition, this would set Switchery as a global and no need to use {
test: /switchery\.js$/,
loader: "imports-loader?module=>false,exports=>false,define=>false,this=>window"
} Note: I only tested the first solution. |
webpack.config.js
That works for me. |
thanks I'll try it |
Why was this closed? I'm getting this issue and it's still there. Was anything fixed in the project? |
I am sorry, I thought it was resolved. and my project was later used in other ways |
also have this error, please fix it |
got same issue. Is there any good way to solve it ? |
if someone want to use it with React - I made a version rewritten for React https://github.com/shlensky/sweetcherry |
@shlensky It looks nice! But I'm not using React, although I use webpack to bundle. Could you give me any direction about solving the "error: Cannot set property 'trackingClick' of undefined" ? |
@sss63232 no 😞 |
Same issue here. Will fallback full css. Shame, it was nice. |
Using import "script-loader!switchery/dist/switchery.js"; |
Good job. that works for me :) |
That works for me("webpack": "^5.35.1", "string-replace-loader": "^3.0.1"):
|
Hi, thanks for this awesome plugin.
Switchery error in webpack, Initialization times wrong
error: Cannot set property 'trackingClick' of undefined(…)
The text was updated successfully, but these errors were encountered: