#Cannot find module

38 messages · Page 1 of 1 (latest)

thick cradle
#

When running unit test am facing this error

Error: Cannot find module '.../node_modules/.pnpm/@[email protected][email protected]/node_modules/@solidjs/router/dist/integration' imported from /node_modules/.pnpm/@[email protected][email protected]/node_modules/@solidjs/router/dist/routing.js

here is my vitest.config.ts configuration

export default mergeConfig(viteConfig, defineConfig({
  test: {
    setupFiles: [
      "./tests/init.ts",
    ],
    environment: "jsdom",
    globals: true,
    threads: false,
    isolate: false,
    includeSource: ["src/**/*.{js,ts,tsx,jsx}"],
    transformMode: {
      web: [/\.[jt]sx?$/],
    },
    open: false,
  },
  resolve: {
    conditions: ["development", "browser"],
  },
}));
hoary geyser
#

Are you able to update to a more recent version of the router?

thick cradle
#

@hoary geyser am not using @solidjs/route am using file routes

hoary geyser
#

Okay, text you posted contain @[email protected]. What version of solid start do you have?

thick cradle
#

"solid-start": "^0.3.10",

stuck plover
#

would be helpful if you could copy paste ur package.json

hoary geyser
#

@thick cradle that is a quite old version of solid start. The newer versions are published as @solidjs/start. You might benefit from upgrading.

thick cradle
# stuck plover would be helpful if you could copy paste ur package.json
  "dependencies": {
    "@modular-forms/solid": "^0.19.1",
    "@solid-primitives/analytics": "^0.1.5",
    "@solid-primitives/date": "^2.0.19",
    "@solid-primitives/script-loader": "^2.0.2",
    "@solid-primitives/storage": "^2.1.1",
    "@tanstack/solid-table": "^8.9.3",
    "@unocss/reset": "^0.53.4",
    "@walletconnect/modal": "^2.6.2",
    "@web3-onboard/injected-wallets": "^2.10.5",
    "alchemy-sdk": "^3.1.0",
    "chart.js": "^4.3.3",
    "chartjs-adapter-date-fns": "^3.0.0",
    "clsx": "^2.0.0",
    "cva": "npm:class-variance-authority@^0.6.1",
    "date-fns": "^2.30.0",
    "eth-chains": "^2.0.0",
    "ethers": "^6.7.1",
    "flat-cache": "^4.0.0",
    "graphql-request": "^6.1.0",
    "graphql-tag": "^2.12.6",
    "gsap": "^3.12.4",
    "solid-chartjs": "^1.3.8",
    "solid-icons": "^1.0.11",
    "solid-js": "^1.8.5",
    "solid-start": "^0.3.10",
    "solid-toast": "^0.5.0",
    "swiper": "^10.3.1",
    "tailwind-merge": "^1.13.2",
    "undici": "^5.22.1",
    "vite-plugin-solid": "^2.7.2",
    "zod": "^3.21.4"
  },
  "devDependencies": {
    "@antfu/eslint-config": "^0.39.4",
    "@faker-js/faker": "^8.0.2",
    "@iconify-json/mdi": "^1.1.52",
    "@playwright/test": "^1.37.1",
    "@solidjs/testing-library": "^0.8.3",
    "@types/flat-cache": "^2.0.2",
    "@types/node": "^20.2.5",
    "@typescript-eslint/parser": "^5.59.8",
    "@vitest/ui": "^0.32.2",
    "eslint": "^8.41.0",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-solid": "^0.12.1",
    "eslint-plugin-storybook": "^0.6.13",
    "eslint-plugin-tailwindcss": "^3.12.1",
    "eslint-plugin-unicorn": "^47.0.0",
    "jsdom": "^22.1.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "solid-start-node": "^0.3.10",
    "typescript": "^5.0.4",
    "unocss": "^0.53.4",
    "vite": "^4.4.9",
    "vite-plugin-solid-svg": "^0.6.4",
    "vite-tsconfig-paths": "^4.2.1",
    "vitest": "^0.31.3"
  },
  "pnpm": {},
  "resolutions": {
    "vite-plugin-inspect": "0.7.38"
  }
thick cradle
thick cradle
#

@stuck plover i have posted the list of the packages I am using please check it

hoary geyser
#

Can you try installing "@solidjs/router": "0.9.1" with resolutions in package.json

stuck plover
thick cradle
#

I already tried that but i faced this error

thick cradle
hoary geyser
thick cradle
#

oops I see

stuck plover
thick cradle
#

yeah it is

stuck plover
#

It happened when we went to solid start beta V2 if I m not mistaken

thick cradle
#

oh okay does it have a documentation on what's been changed

#

I have seen the solid start beta v2 documentation

stuck plover
#

But some things might have changed from that moment on

#

Beta V2 was quite a big change, a rebase on nitro and a new router. This version will be much closer to the API when it comes out of beta.

thick cradle
#

yeah but am working on a prod app it will be difficult for me to migrate it just to add a test for one module

hoary geyser
#

Here is a working example of the new solid-start:
https://stackblitz.com/github/solidjs/solid-start/tree/main/examples/basic

What you want to pay attention to is the vite.config.ts -> app.config.ts, where now the vite settings are moved within a vite property { vite: {} }

Also, the entry-server, entry-client changed, and the router api changed, so where it before was:



      <Router>
         <SomeProvider>
            <A href"Here">Test</A>

            <Routes>
              <Route
                path={['/:user/:repl', '/scratchpad']}
                element={<Edit />}
              />
              <Route path="/:user" element={<Home />} />
              <Route path="/" element={<Home />} />
              <Route path="/login" element={<Login />} />
            </Routes>
         </SomeProvider>
      <Router>

      <Router root={(props)=>(
         <SomeProvider>
          <A href"Here">Test</A>
          <Suspense>{props.children}</Suspense>
         </SomeProvider>
      )}>
        <Route
          path={['/:user/:repl', '/scratchpad']}
          component={Edit}
        />
        <Route path="/:user" component={Home} />
        <Route path="/" component={Home} />
        <Route path="/login" component={Login} />
      </Router>

#

@thick cradle , I understand the frustration, but there are not being made patch releases to the version you're on currently if something is off.

I can help you with this though:
#1219260239900053534 message

Does there error say more about where it breaks? It's typically because of useSearchParams, or A used outside the pages.

thick cradle
#
import { Environment } from "@axelar-network/axelarjs-sdk";
import { beforeEach, describe, expect, it } from "vitest";

import Axelar from "./axelar";

describe("Axelar", () => {
  let axelar: Axelar;

  beforeEach(() => {
    axelar = new Axelar();
  });

  it("should initialize with the correct environment", () => {
    expect(axelar.getAxelarQuery().environment).toEqual(
      process.env.NODE_ENV === "production" ? Environment.MAINNET : Environment.TESTNET,
    );
  });
});
#

here is the test

#
import type { SendTokenParams } from "@axelar-network/axelarjs-sdk";
import { AxelarAssetTransfer, AxelarQueryAPI, Environment } from "@axelar-network/axelarjs-sdk";
import { ethers, Wallet } from "ethers";
import { type Accessor, createResource } from "solid-js";
import { isServer } from "solid-js/web";
import type { ContractOptions } from "~/contracts/types";
import { useContractOptions } from "~/providers/contract-options-provider";
import type { OnboardActions } from "~/providers/onboard-provider";
import { useWeb3Onboard } from "~/providers/onboard-provider/context";
import { createResourceWrapper, type ResourceCache, type ResourceWrapper } from "~/util/resource";
#

and the above is the import inside the axelar file

thick cradle
hoary geyser
thick cradle
#

i see great

#

do you know if we have

thick cradle