Closed fethca closed 2 weeks ago
Hi @fethca, I have created a PR for this now:
And it includes some fixes:
esm
type files get the .js
extension automatically in the build process.I tested my changes in a fresh vite project with different tsconfig
settings and after my fixes all the following setups did build without any errors (with skipLibCheck: false
):
module
: commonjs
module
: nodenext
moduleResolution
: nodenext
moduleResolution
: bundler
moduleResolution
: node
@fethca feel free to try v8.1.5 out and see if it solves the problem.
Hi @davidjerleke, I confirm it builds for my config too ! Thanks for the work
@fethca thanks for testing 🎉! You may unpublish the POC if you want.
Which variants of Embla Carousel are you using?
Steps to reproduce
The current version of Embla Carousel lacks compatibility with the
nodenext
module resolution setting in TypeScript. It requires explicit file extensions in ESM imports. This will cause the build to fail with the error :The tsconfig I use to test it :
Expected Behavior
No error on build
Additional Context
I did a PoC of what would need to be done on this fork and released this version on npm to test it on my applications. From what I saw most of the job is to explicitely add proper file extension in import path so
import { AnimationsType } from './Animations'
becomesimport { AnimationsType } from './Animations.js'
. This change will break the rollup config for writing types cause it's used to add.ts
to paths, I just changed it tofs.writeFileSync(esmTypesFilePath, esmTypesFile)
.I only adapted
embla-carousel
&embla-carousel-react
packages as those are the ones I needed for my app.What browsers are you seeing the problem on?
No response
Version
8.1.4
CodeSandbox
No response
Before submitting