Fix .default is not a function errors #18188
Merged
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.
When building with the extensions-sdk using a generated template (using a hook template for example), an error such as the following will occur:
The image shows it for
replace.default
, but the same issue exists forcommonjs
,json
,terser
.The fix seems to work after removing all the
.default
added in https://github.com/directus/directus/pull/18014/files#diff-a5033ca89b34aa9443a9a7d79f0a134c6562795edeb3e5a87cbaab9c01655c1b, but there are still typescript errors when actually building theextensions-sdk
, hence the addition of// @ts-ignore
comments, which aren't ideal.I also wonder if it's possible to resolve this by upgrading
@rollup/plugin-commonjs
, but it was recently intentionally downgraded in #17539.