+
Skip to content

Conversation

schiller-manuel
Copy link
Contributor

this fixes ESM import

fixes TanStack/router#2802

@jedrzejchalubek jedrzejchalubek merged commit f4318b4 into glidejs:master Nov 20, 2024
3 checks passed
@jedrzejchalubek
Copy link
Member

Thanks!

@rodrigopedra
Copy link

Hey @jedrzejchalubek, thanks for working on Glide.

This change broke my modular import:

import Glide, {Images, Swipe} from '@glidejs/glide/dist/glide.modular.esm';

With the error message below:

Module not found: Error: Package path ./dist/glide.modular.esm.js is not exported from package /home/rodrigo/code/project/node_modules/@glidejs/glide (see exports field in /home/rodrigo/code/project/node_modules/@glidejs/glide/package.json)

Reverting to 3.6.2 resolved the issue.

How should I import it on the new version?

Also, I guess it is related, all SCSS imports stopped working:

ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Can't find stylesheet to import.
   ╷
20 │ @import '@glidejs/glide/src/assets/sass/glide.core.scss';
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵

Reverting to 3.6.2 also resolved this.

@dzakki
Copy link

dzakki commented Nov 21, 2024

Hey @jedrzejchalubek, thanks for working on Glide.

This change broke my modular import:

import Glide, {Images, Swipe} from '@glidejs/glide/dist/glide.modular.esm';

With the error message below:

Module not found: Error: Package path ./dist/glide.modular.esm.js is not exported from package /home/rodrigo/code/project/node_modules/@glidejs/glide (see exports field in /home/rodrigo/code/project/node_modules/@glidejs/glide/package.json)

Reverting to 3.6.2 resolved the issue.

How should I import it on the new version?

Also, I guess it is related, all SCSS imports stopped working:

ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Can't find stylesheet to import.
   ╷
20 │ @import '@glidejs/glide/src/assets/sass/glide.core.scss';
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵

Reverting to 3.6.2 also resolved this.

I'm facing the same issue 😢

@emrysal
Copy link

emrysal commented Nov 21, 2024

Similarly this looks to have broken on the @calcom project:

image

@jedrzejchalubek
Copy link
Member

jedrzejchalubek commented Nov 22, 2024

@rodrigopedra @dzakki Can you check if import simply as this will work for you?

import Glide, {Images, Swipe} from '@glidejs/glide';

This should be all what is needed when project has type: module

Looks like, some additional exports needs to be set up in order to CSS and SCSS imports to work, need to verify it

jedrzejchalubek pushed a commit that referenced this pull request Nov 22, 2024
)

Fixes #700, #701 so that `import "@glidejs/glide/css/glide.core.css"` for example works again
@rodrigopedra
Copy link

Unfortunately, I can't add "type": "module" to my project's package.json, as it uses an outdated webpack configuration.

Tried adding it, but couldn't run.

An upgrade to this project is planned for the following months, so for now, I will just keep glide fixed at 3.6.2.

Thanks for looking into it @jedrzejchalubek, and thanks for this great project

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't import Glide from "@glidejs/glide", but can import Glide from "@glidejs/glide/dist/glide.esm.js"

5 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载