Skip to content

ESM exports + updates#9

Merged
ryansolid merged 1 commit intosolidjs:mainfrom
atk:esm-exports
Feb 26, 2022
Merged

ESM exports + updates#9
ryansolid merged 1 commit intosolidjs:mainfrom
atk:esm-exports

Conversation

@atk
Copy link
Copy Markdown
Collaborator

@atk atk commented Feb 24, 2022

@sheremet-va
Copy link
Copy Markdown
Contributor

Shouldn’t cjs export have cjs extension? Not sure if native node can process js file in a module project with require().

@atk
Copy link
Copy Markdown
Collaborator Author

atk commented Feb 24, 2022

That is actually not neccessary if we omit type: "module" and thus, don't force node into a certain mode. Tested it again and it seems to work.

@sheremet-va
Copy link
Copy Markdown
Contributor

That is actually not neccessary if we omit type: "module" and thus, don't force node into a certain mode. Tested it again and it seems to work.

Then I don't think ESM will work :)
If you need dual support, one of them should be names cjs or mjs (depending on the base).

At least Vitest will default to cjs with this config, since importing exact file (not module) will throw

- add esm exports, fixes issue solidjs#8
@atk
Copy link
Copy Markdown
Collaborator Author

atk commented Feb 25, 2022

OK, I changed the exports to cjs and mjs so vitest and node may detect it properly; also increased the required node version to at least 14 to switch to a version that even allows these imports.

@ryansolid ryansolid merged commit 93a3285 into solidjs:main Feb 26, 2022
@ryansolid
Copy link
Copy Markdown
Member

Thank you

@atk atk deleted the esm-exports branch February 26, 2022 05:19
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.

3 participants