Skip to content
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

WIP: Migrate from ember-cli-mirage to msw and @mswjs/data #10393

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Jan 15, 2025

No description provided.

@Turbo87 Turbo87 added A-frontend 🐹 C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear labels Jan 15, 2025
@Turbo87 Turbo87 force-pushed the msw branch 5 times, most recently from 87a8963 to 400fa6c Compare January 17, 2025 10:35
@eth3lbert
Copy link
Contributor

eth3lbert commented Jan 18, 2025

Hmm, since msw is optional in @mswjs/data, I think we could use the webpack's externals trick to just let it get from the global (or other likes window, self, ...).
This would look something like following:

// ember-cli-build.js

...

  return require('@embroider/compat').compatBuild(app, Webpack, {
    extraPublicTrees,
    staticAddonTrees: true,
    staticAddonTestSupportTrees: true,
    staticModifiers: true,
    packagerOptions: {
      webpackConfig: {
        resolve: {
          fallback: {
            // disables `crypto` import warning in `axe-core`
            crypto: false,
            // disables `timers` import warning in `@sinon/fake-timers`
            timers: false,
          },
        },
        externals: ({ request, context }, callback) => {
          if (request == 'msw' && context.includes('@mswjs/data')) {
            return callback(null, request, 'global');
          }
          callback();
        },
      },
    },
  });

I'm not sure if this is more better than the patch approach though 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
Status: For next meeting
Development

Successfully merging this pull request may close these issues.

2 participants