title: Apollo Client "Named export 'remove' not found"
body: <p>I'm attempting to create an <code>apollo client</code> plugin for a <code>Nuxt 3</code> application. It's currently throwing an error regarding a package called <code>ts-invariant</code>:</p>
  <pre class="lang-sh prettyprint-override"><code>file:///Users/[my name]/Repositories/[project]/node_modules/@apollo/client/utilities/globals/fix-graphql.js:1
  import { remove } from &quot;ts-invariant/process/index.js&quot;;
           ^^^^^^
  SyntaxError: Named export 'remove' not found. The requested module 'ts-invariant/process/index.js' is a CommonJS module, which may not support all module.exports as named exports.
  CommonJS modules can always be imported via the default export, for example using:
  
  import pkg from 'ts-invariant/process/index.js';
  const { remove } = pkg;
  
      at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
      at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)
      at async Promise.all (index 0)
      at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
      at async __instantiateModule__ (file:///Users/[my name]/Repositories/[project]/.nuxt/dist/server/server.mjs:4550:3)
  [vite dev] Error loading external &quot;/Users/[my name]/Repositories/[project]/node_modules/@apollo/client/core/index.js&quot;.
    at file://./.nuxt/dist/server/server.mjs:3170:289  
    at async __instantiateModule__ (file://./.nuxt/dist/server/server.mjs:4550:3)
  </code></pre>
  <p><strong>I feel like I know enough about this error to know it has something to do with how Nuxt 3 deals with ESM, but I can't be for certain.</strong></p>
  <p>Here's the nuxt plugin: <br />
  <code>plugins/apollo-client.js</code></p>
  <pre class="lang-js prettyprint-override"><code>import { defineNuxtPlugin } from &quot;#app&quot;
  import { ApolloClient, InMemoryCache } from &quot;@apollo/client/core&quot;
  import { DefaultApolloClient } from &quot;@vue/apollo-composable&quot;
  
  export default defineNuxtPlugin((nuxtApp) =&gt; {
    const config = useRuntimeConfig()
    const apolloClient = new ApolloClient({
      uri: config.PUBLIC_API_ENDPOINT,
      cache: new InMemoryCache(),
    })
    nuxtApp.vueApp.provide(DefaultApolloClient, apolloClient)
  })
  </code></pre>
  <p>In a normal scenario, I might use the nuxt-apollo community module, but it is currently afk regarding a <code>nuxt 3</code> port, so a plugin it is.</p>
  <p>Here's some documentation I relied on for my plugin:<br />
  <a href="https://v4.apollo.vuejs.org/guide-composable/setup.html#vue-3" rel="noreferrer">https://v4.apollo.vuejs.org/guide-composable/setup.html#vue-3</a><br />
  <a href="https://v3.nuxtjs.org/docs/directory-structure/plugins" rel="noreferrer">https://v3.nuxtjs.org/docs/directory-structure/plugins</a></p>