-
-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support .cts
and .mts
#3831
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #3831 +/- ##
==========================================
- Coverage 91.64% 91.42% -0.23%
==========================================
Files 22 22
Lines 1628 1667 +39
Branches 466 480 +14
==========================================
+ Hits 1492 1524 +32
- Misses 136 143 +7
Continue to review full report in Codecov by Sentry.
|
And I really hope we will not have |
} | ||
break; | ||
} | ||
case "esm": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid extra require
for esm
(i.e. mts
and mjs
)
@@ -1,7 +1,7 @@ | |||
path = require 'path' | |||
|
|||
config = | |||
mode: 'production' | |||
mode: 'development' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For faster tests
".webpack/webpack.config", | ||
".webpack/webpackfile", | ||
].flatMap((filename) => extensions.map((ext) => path.resolve(filename + ext))); | ||
const defaultConfigFiles = new Set( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid duplicates
the current method seems good enough for normal use case and we're going to support this as well |
Some magic:
.cts
and.mts
.mts
is still have hacky support -NODE_OPTIONS="--loader ts-node/esm" webpack-cli --config ./webpack.config.mts
.cts
works fine.ts
works out of box forCommonJS
, but need a hack from above for.mts
.mts
to avoid using extrarequire
@hardfist there is basic support for
.cts
and.mts
(.ts
already supported), no problems withcommonjs
, butesm
using is still hacky duerechoir
doesn't supportESM
hooks for Node.js (because Node.js changed it multiple times recently and it is still not stable).What kind of change does this PR introduce?
I want to say it is a
bugfix
Did you add tests for your changes?
Soon
If relevant, did you update the documentation?
No need
Summary
Better support typescript configurations
Does this PR introduce a breaking change?
No
Other information
No