Skip to content

Commit 96e4332

Browse files
MustafaHaddaraljharb
authored andcommittedJul 26, 2021
[resolvers/node] [New] use "module" in the same spot as "jsnext:main"
1 parent 9521284 commit 96e4332

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
 

‎resolvers/node/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
55

66
## Unreleased
77

8+
### Added
9+
- use "module" in the same spot as "jsnext:main" ([#2166], thanks [@MustafaHaddara])
10+
811
## v0.3.4 - 2020-06-16
912
### Added
1013
- add `.node` extension ([#1663])
@@ -48,6 +51,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
4851
### Fixed
4952
- find files with `.json` extensions (#333, thanks for noticing @jfmengels)
5053

54+
[#2166]: https://github.com/benmosher/eslint-plugin-import/pull/2166
5155
[#438]: https://github.com/benmosher/eslint-plugin-import/pull/438
5256

5357
[#1663]: https://github.com/benmosher/eslint-plugin-import/issues/1663
@@ -61,3 +65,4 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
6165
[@SkeLLLa]: https://github.com/SkeLLLa
6266
[@ljharb]: https://github.com/ljharb
6367
[@opichals]: https://github.com/opichals
68+
[@MustafaHaddara]: https://github.com/MustafaHaddara

‎resolvers/node/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ function opts(file, config) {
4242
}
4343

4444
function packageFilter(pkg) {
45-
if (pkg['jsnext:main']) {
46-
pkg['main'] = pkg['jsnext:main'];
45+
if (pkg.module) {
46+
pkg.main = pkg.module;
47+
} else if (pkg['jsnext:main']) {
48+
pkg.main = pkg['jsnext:main'];
4749
}
4850
return pkg;
4951
}

0 commit comments

Comments
 (0)
Please sign in to comment.