Failed to load wmr.config.ts
Aloento opened this issue ยท 4 comments
Aloento commented
Describe the bug
yarn create wmr
rename wmr.config.mjs
to wmr.config.ts
then:
Error: Failed to load wmr.config.ts
Error [ERR_REQUIRE_ESM]: require() of ES Module .\node_modules\wmr\index.js from .\wmr.config.js not supported.
Instead change the require of index.js in .\wmr.config.js to a dynamic import() which is available in all CommonJS modules.
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received an instance of URL
Bug occurs with:
-
wmr
orwmr start
(development) -
wmr build
(production) -
wmr serve
Desktop (please complete the following information):
- OS: Win 11
- Node Version: 17
- WMR Version: newest
rschristian commented
You could add "type": "module"
to your package.json
if you want to use a TS config at the moment.
We could ship a CJS version of the DefineConfig
to fix this. Should be fine to do I imagine.
developit commented
Do we support .ts
for configs?
rschristian commented
Yes, we do. It can end up transpiled to CJS though, which results in that require()
:
wmr/packages/wmr/src/lib/normalize-options.js
Lines 106 to 116 in caf7ff8
rschristian commented
Going to reopen this as it's a legitimate issue that hasn't yet been fixed.