Skip to content

Commit 548206e

Browse files
committed
msw: Prevent @mswjs/data from bundling the msw package
1 parent 460ac90 commit 548206e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ember-cli-build.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ module.exports = function (defaults) {
8080
staticModifiers: true,
8181
packagerOptions: {
8282
webpackConfig: {
83+
externals: ({ request, context }, callback) => {
84+
// Prevent `@mswjs/data` from bundling the `msw` package.
85+
//
86+
// `@crates-io/msw` is importing the ESM build of the `msw` package, but
87+
// `@mswjs/data` is trying to import the CJS build instead. This is causing
88+
// a conflict within webpack. Since we don't need the functionality within
89+
// `@mswjs/data` that requires the `msw` package, we can safely ignore this
90+
// import.
91+
if (request == 'msw' && context.includes('@mswjs/data')) {
92+
return callback(null, request, 'global');
93+
}
94+
callback();
95+
},
8396
resolve: {
8497
fallback: {
8598
// disables `crypto` import warning in `axe-core`

0 commit comments

Comments
 (0)