I’m trying to force Ember auto import to use ./dist/msw-config.js
as the default export for the mirage-msw
package.
By default it uses the commonJS ./dist/msw-config.cjs
file, which results in a browser error.
The following is from the mirage-msw package.json file:
"main": "dist/msw-config.cjs",
"module": "dist/msw-config.js",
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/msw-config.d.ts",
"default": "./dist/msw-config.js"
},
"require": {
"types": "./dist/msw-config.d.cts",
"default": "./dist/msw-config.cjs"
}
}
}
If I add an export such as "./foo": "./dist/msw-config.js"
, then the following works in ember-cli-build.js
autoImport: {
alias: {
'mirage-msw': 'mirage-msw/foo',
},
},
However, I’m unsure of how to set the alias with the exports as they are.
I’m also keen to understand why Ember would be using the require
export by default, when the package is included via an import statement.
For context, I created a non-Ember app, and with basic webpack config that used ./dist/msw-config.js
as the default export.