NuxtN
Nuxtβ€’3y agoβ€’
5 replies
oemer

How to fix "[module] is not export by [path]" error during build, when it works on development?

Here is the error I get on
yarn build

ERROR  "MasterDataClient" is not exported by "../../../packages/clients/dist/src/index.js", imported by "base/domains/master-data/useMasterDataApi.ts".
file: /Users/name/Documents/dev/app/frontend/app/base/domains/master-data/useMasterDataApi.ts:1:9
1: import { MasterDataClient } from "@workspace/clients"

I had the same error in development and fixed it with:
  vite: {
    optimizeDeps: {
      include: ["@workspace/clients"],
    },
  }


This is the
index.js
it cannot import:
Object.defineProperty(exports, "__esModule", { value: true });
exports.MasterDataClient = __importStar(require("./clients/master-data-client"));
//...

yarn dev
works, but
yarn build
fails. It's a local yarn workspace package .
Was this page helpful?