Comments (12)
Node - v14.16.0
OS - macOS Catalina 10.15.17
This is the only library I've ever had this issue with.
from auto-animate.
I don't have enough time to create a minimal repos to reproduce the issue yet, but first here is the information
- Node version:
$ node -v
v14.17.6
- OS version: macOS Monterey 12.4
from auto-animate.
I think you can just change "import"
to "default"
if you don't want a CJS copy. Or only enforce the rule at node side:
"exports": {
".": {
"node": { "import": "./index.js" },
"default": "./index.js"
}
}
I know the reason you're doing this now is for telling people they cannot require
the library. But in fact they can -- when they have a bundler. Using default
for exporting front-end files is a good practice since we must be careful enough to not including the same library twice (one ESM and another CJS). You can read more about dual package in Node.js' doc.
For a temporary workaround, you can always write an esbuild plugin / tsconfig.path to manaully resolve a file:
var dedup_auto_animate_plugin = {
name:"dedup:auto-animate",
setup(build) {
build.onResolve({ filter: /^@formkit\/auto-animate$/ }, args => {
return { path: path.resolve("node_modules/" + args.path + "/index.js") } // didn't test
})
}
}
from auto-animate.
Thanks, we'll get this into the next build. Are you able to provide a minimal reproduction that throws this error so we can test various import/export combos? Also relevant information:
- Node version
- OS
from auto-animate.
Also getting the same, is there a temporary solution for this until a fix is pushed?
from auto-animate.
Still need node version and os version to begin to trouble shoot this. Most people dont seem to have this issue so its unclear what is different about your installations.
from auto-animate.
@nghuuphuoc Question on this βΒ are you importing this using CommonJS (require
) instead of using import
? We don't ship a CJS file at all at the moment.
from auto-animate.
@justin-schroeder Our codebase isn't written in JavaScript directly, that's why it is a little bit complicated to create a repos for you.
However, as you can see in the error
error] β [ERROR] Could not resolve "@formkit/auto-animate"
[error] ../main.js:2:51:
[error] 2 β ...040formkit$002fauto$002danimate = require("@formkit/auto-animate");
The code is transpiled to JavaScript via a require
call. I can't change the build because it effects many JS libs used in our codebase.
This is the only library we have problem with, because the other libs provide CJS compatible build.
from auto-animate.
Changing it to default
would be helpful. I currently have everything transformed to CommonJS before testing with jest and the import for @formkit/auto-animate
always fails.
from auto-animate.
I think you can just change "import" to "default" if you don't want a CJS copy. Or only enforce the rule at node side:
I tried this locally and it looks like @babel/plugin-transform-modules-commonjs
works as expected when the file is .js
but not .mjs
.
I edited the package.json
in node_modules to look like this (and renamed the file to index.js
from index.mjs
)
"exports": {
".": {
"import": "./index.js",
"default": "./index.js"
}
}
and everything was fixed.
from auto-animate.
Hi there! Any estimated time to fix this issue? Is happening to me too in the component files and in the test
from auto-animate.
In theory this should be working now in Beta.4 π
from auto-animate.
Related Issues (20)
- Omi supports it, this's a great project HOT 1
- Memory Leak
- Bug when deleting element of the array in React 18
- Inconsistent jumping inside flex item HOT 1
- Not working HOT 4
- Vue Virtual Scroller
- Wrong arguments order in AutoAnimationPlugin declaration
- Animate across lists? Across all elements inside a `ul`?
- How should I use fixed centering layout? HOT 1
- Incorrect rounding of element sizes while animating HOT 2
- When the page is refreshed, the component has no animation.
- Vue useAutoAnimate not working with v-if
- does not provide an export named 'autoAnimate'
- Animation starting coords are buggy when the container has transitioned positions
- How to add auto-animate to custom components (NuxtUI) HOT 1
- Headless UI + Auto-Animate | Issue with auto-animate conflicting
- nuxt3 3.10.3 does not provide an export named 'autoAnimate' HOT 1
- I added the element from the front but the animation still appears from the last one HOT 1
- React.Children.map issue HOT 1
- How to animate single element? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auto-animate.