Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had an issue with my ESM build related to css-tree import (related to #89)
Had to do some digging here, but I believe I have found the root issue:
css-tree's index.d.ts does not match their actual distributed code. Their index.d.ts file says that there is NO default export so if we would do this:
we would get a TypeScript error.
But when inspecting in css-tree's node_modules I see the following:
In package.json their main is "lib/index.js", and that file is
module.exports = require('./syntax');
, which is a default export.Ideally they would fix this, but a "quickfix" for our case is to specify
such that we can do
without getting any errors.
Something unexplainable
I still don't get how jest have managed to make it work though, but it could be how jest does dynamic imports that allows jest to not crash in this case. Either way jest still works with these changes.
Tested
I have tested this change on my ESM project and it fixed it. I have not tested this on a CJS project, but I think it should work.