Skip to content

Error: Cannot find package '.../index.js' imported from @minecraft/math #1

@legopitstop

Description

@legopitstop

Describe the bug

Running vitest with this package throws an unexpected error.

Error: Cannot find package '../index.js' imported from @minecraft\math\lib\src\aabb\coreHelpers.js

Steps To Reproduce

  1. Install @lpsmods/minecraft-server-mock.
  2. Use @minecraft/server in a unit test.
  3. Include resolve.alias in your vitest config as defined on NPM.
  4. Run tests.
  5. Get an error while running tests.

Expected behavior

No error. Tests run as expected.

@minecraft Module Version

2.4.0

Package

@lpsmods/minecraft-server-mock

Package Version

0.0.1

Platform

Any

Additional context

This problem can be fixed by including server.deps.inline in your vitest config file.

import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    globals: true,
    environment: "node",
    server: {
      deps: {
        inline: ["@minecraft/math"],
      },
    },
  },
  resolve: {
    alias: {
      "@minecraft/server": "@lpsmods/minecraft-server-mock",
    },
  },
});

Metadata

Metadata

Assignees

Labels

wontfixThis will not be worked on

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions