-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Zepto doesn't work with npm and webpack #1324
Comments
TypeScript support would also be nice! |
any progress with this? |
If you want to use Zepto because it's lighter and less bloated than jQuery, as did I, go with a custom jQuery build. Here are the instructions. |
OK , thank you. |
This is insane |
Wtf how is this a thing? I just did exactly as you described. Cant believe it doesn't work that easy. I guess It can be added outside the bundle and then "$" set as a global var. |
Zepto is dead to me because of this. Luckily, you don't really need jQuery anymore, it's easier and less painful to use vanilla js |
same to me |
this workaround gets zepto 1.2.0 (latest npm release) working with webpack: environment.config.module = {
rules: [
{
test: require.resolve("zepto"),
use: "imports-loader?this=>window"
}
]
} then to use zepto as a jquery replacement: environment.config.resolve = {
alias: {
jquery: "zepto"
}
} need to install the imports-loader webpack plugin first |
Same for me, simple import breaks everything. Can't use this library.
|
Hi @madrobby, can you look at this? |
due to the issue, I had to refuse usage of zepto in a large project |
To augment sqrTt words, same here, from a CTO |
It still has to work in browsers that don't support import or require, doesn't it? I hate to be that guy, but how is it you have time to b1tch about it on GitHub, but you don't have time for a fork-and-fix? |
And then support/maintain for EOL, while the issue is fixed in master just not released to npm. See #1244 |
Just be realistic about it guys... there is still no valid replacement for jquery 🤣 |
If you stick to the evergreen browsers, there's almost no need for jQuery. I haven't needed much more than
for years. About 90% of the main-stream jQuery use can be supplied by functions taking the results of $() and using vanilla JS to get the job done. |
I wrote a new webpack configuration to be able to use the demo app within the new toolchain. I also removed some obscure resolves and fixed Webpack HMR. The current version does not work with zepto. madrobby/zepto#1324 I am not willing to do this workaround. Maybe, there will be a zepto version in near future.
I wrote a new webpack configuration to be able to use the demo app within the new toolchain. I also removed some obscure resolves and fixed Webpack HMR. The current version does not work with zepto. madrobby/zepto#1324 I am not willing to do this workaround. Maybe, there will be a zepto version in near future.
Works for Me with fuse-box, which is built on typescript and so allows for synthetic imports. import 'zepto/src/zepto'
import 'zepto/src/event'
import 'zepto/src/fx'
document.addEventListener("DOMContentLoaded", function(event) {
Zepto("#hi")
.animate({
opacity: 0.25, left: '50px',
color: '#abcdef',
rotateZ: '45deg', translate3d: '-100px,-100px,-100px'
}, 10000, 'ease-out')
}) EDIT: I was originally importing the whole thing plus fx. The correct way to do it is to import zepto.js, event.js, and fx.js for the given example. Something missing from the docs is that these modules have some level of inter-dependency. EG, fx.js depends on events.js |
what a waste of time to attempt using zepto.... |
This issue was closed #1222 with no reason :)
Leads to
The workaround provided, "use master branch" does not work either, since requiring module from github with npm (
npm install madrobby/zepto#master
) results in a non-built package, that can't be required, thenLeads to
This is dead simple, there is no need for any explaination, but a real need for a
git merge
and annpm publish
basicallyRequiring a module from the most popular package manager, then using it through the most popular module bundler does seem like a basic requirement for a 13k stars js library in 2017, doesn't it ?
The text was updated successfully, but these errors were encountered: