Skip to content

fix(es6): Ensure relative imports have file extensions #37

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

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

echoix
Copy link
Contributor

@echoix echoix commented Mar 20, 2025

Hello!

I'm trying to make my renovate PR work with the newly released 3.0.0 version, but I can't run my webpack+postcss build with it, it fails with an error similar to:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '[redacted]/node_modules/sort-css-media-queries/lib/create-sort' imported from [redacted]/node_modules/sort-css-media-queries/lib/index.js

I searched a little, and it seems that following the step 4 here of this blog post https://electerious.medium.com/from-commonjs-to-es-modules-how-to-modernize-your-node-js-app-ad8cdd4fb662 solves the issue for me.

I fixed it locally, and indeed works (node v20.18.3).

I'm not a usual node developer, but this also seems to be coherent with the indication of https://nodejs.org/api/esm.html#esm_mandatory_file_extensions, where file extensions are mandatory.

@echoix echoix changed the title fix(es6): Ensure relative imports have extensions fix(es6): Ensure relative imports have file extensions Mar 20, 2025
@OlehDutchenko OlehDutchenko merged commit 5f6c6fb into OlehDutchenko:master Mar 21, 2025
1 check passed
@OlehDutchenko OlehDutchenko added the javascript Pull requests that update javascript code label Mar 21, 2025
@OlehDutchenko
Copy link
Owner

Hi @echoix!
Thanks for your PR!
A new version has just been published on NPM
https://www.npmjs.com/package/sort-css-media-queries/v/3.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants