Skip to content
Discussion options

You must be logged in to vote

I took a look and the issue is mostly same as #7591.
Vitest's cjs in workspace doesn't work out of the box and, in your case, it might be simpler to add your cjs packages to deps.external https://stackblitz.com/edit/github-k8n7qkao?file=packages%2Fapp%2Fvitest.config.ts

  test: {
    server: {
      deps: {
        external: [
          /\/packages\/common\/dist\/index.cjs/,
          /\/packages\/user\/dist\/index.cjs/,
        ]
      },
    },
  }

The alternative is doing the opposite and force mjs to be picked up https://stackblitz.com/edit/github-k8n7qkao-8rcrspsz?file=packages%2Fapp%2Fvitest.config.ts

  test: {
    alias: {
      // pointint to src/index.ts should also work similar

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@jeirebua
Comment options

@hi-ogawa
Comment options

@jeirebua
Comment options

@hi-ogawa
Comment options

Answer selected by jeirebua
@jeirebua
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants