Closed G-Rath closed 3 years ago
The types should be mostly correct, but plugins & other dependencies require some upstream updates to be v8 compatiable i.e. https://github.com/DefinitelyTyped/DefinitelyTyped/pull/53003
Thanks. Looks great.
But can I also ask you to add ESM export
test for postcss.config.ts
with "module": "esnext"
in tsconfig.json
?
@ai I can do an approximation of that, but it won't be completely possible without upgrading jest and configuring module support (i.e you need to run node with --experimental-vm-modules
) since using esnext
means that the test suite has to be able to use import/export
.
I can implement the use of interopRequireDefault
which should be the key thing required to provide nice support for both modules & commonjs.
Yeap, you can update Jest and change how we run tests
I don't think this is possible without making a breaking change, as you have to set "type": "module"
in the root package.json
, which means require
cannot be used anywhere (not to mention iirc this impacts downstream users on the module).
I'm happy to explore this, but think it would be better to land support for this as is (as that matches how other libraries like jest
, webpack
, karma
, ajv
, etc are supporting it), and then look at refactoring the codebase for native ESM support as a follow up.
I asked this, because I'm afraid that ts-node
is a bad solution.
A few months ago, there was no way to use ts-node
with ESM in TS. If it is still a problem, can we switch to another method?
I'm afraid that ts-node is a bad solution.
Is that a statement or a concern? My experience with ts-node
so far (which includes my using it to implement support for configs written in TypeScript for a number of tools) has been pleasant and I don't know of any other solution that's as light weight or universal (i.e you could do it with babel, but that's a huge dependency to have for this feature; you could also probably do it with something like esbuild
, but then that means you're pulling in binaries that have OS requirements as well as not having type-checking).
My understanding is that ESM is now supported at a similar level to Node.
I can confirm I've been able to create a project with module
set to esnext
which ts-node
is able to correctly execute.
Great news. Yeap, letโs do it this way (I will need a day to merge and release it).
I will play with ts-node
and ESM support on my hobby project first. I hope to release it next week.
Awesome - let me know if there's anything I can help with :)
Sorry, for the delay. I am back to review the PR.
LGTM. Hope to merge and release it tomorrow (sorry, I am moving from one country to another, donโt have a lot of time for open source this month).
Thanks. Released in 3.1.
Notable Changes
This lands support for
postcss.config.ts
๐Commit Message Summary (CHANGELOG)
Type
SemVer
Issues
Checklist