Failed to resolve entry for package "remix-utils".
cjoecker opened this issue · 4 comments
Describe the bug
When I mock remix-ultils
with vitest
as vi.mock("remix-utils")
, I get the error
Error: Failed to resolve entry for package "remix-utils". The package may have incorrect main/module/exports specified in its package.json: Missing "." specifier
Your Example Website or App
codesandbox.io/p/devbox/validated-form-error-forked-kd6m28?file=%2Fsrc%2FApp.test.tsx%3A10%2C1
Steps to Reproduce the Bug or Issue
Open codesandbox and see the terminal errors while running tests.
Expected behavior
There is no error on mocking remix-utils
Screenshots or Videos
No response
Platform
remix-utils
v. 7.1.0
Additional context
No response
There’s nothing at remix-utils, each util is a different module. You can see how to import each util individually in the README.
Recently upgraded to Remix v2
and am having an issue where VSCode isn't picking up any of the remix-utils
modules when using the same import path shown in the Honeypot README examples
Everything works fine when using relative import paths
still getting the same issue after making the changes suggested in this thread: #228 (comment)
My file setup below
remix.config.js
/** @type {import('@remix-run/dev').AppConfig} */
import { config } from "@netlify/remix-adapter";
export default {
serverModuleFormat: "esm",
...config,
ignoredRouteFiles: ["**/.*"],
serverPlatform: "node",
server:
process.env.NETLIFY || process.env.NETLIFY_LOCAL
? "./server.ts"
: undefined,
serverBuildPath: ".netlify/functions-internal/server.js",
postcss: false,
tailwind: true,
serverDependenciesToBundle: [
"@radix-ui/themes",
/^rc-util.*/,
],
};
tsconfig.json
{
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2019",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
"noEmit": true
}
}
package.json
{
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix build",
"dev": "yarn run check-env-file && remix dev --manual",
"start": "netlify dev",
"typecheck": "tsc",
"check-env-file": "node ./scripts/check-env-file.mjs",
"postinstall": "prisma generate",
"stripe:listen": "stripe listen --forward-to localhost:3000/webhook",
"format": "prettier --write .",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint ."
},
"dependencies": {
"@aws-sdk/client-s3": "^3.363.0",
"@conform-to/react": "^0.9.1",
"@conform-to/zod": "^0.9.1",
"@heroicons/react": "^2.0.18",
"@netlify/functions": "^2.3.0",
"@netlify/remix-adapter": "^2.2.0",
"@prisma/client": "^4.13.0",
"@radix-ui/colors": "^3.0.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/themes": "^2.0.1",
"@remix-run/css-bundle": "^2.2.0",
"@remix-run/express": "^2.2.0",
"@remix-run/node": "2.2.0",
"@remix-run/react": "2.2.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cross-env": "^7.0.3",
"dotenv": "^16.0.3",
"isbot": "^3.6.8",
"openai": "^3.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remix-auth": "^3.6.0",
"remix-auth-socials": "^2.0.5",
"remix-utils": "^7.1.0",
"stripe": "^12.3.0",
"tailwind-merge": "^2.0.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@remix-run/dev": "2.2.0",
"@remix-run/eslint-config": "2.2.0",
"@remix-run/serve": "2.2.0",
"@types/eslint": "^8.44.3",
"@types/react": "^18.0.35",
"@types/react-dom": "^18.0.11",
"eslint": "^8.38.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.0.0",
"prettier": "^3.0.3",
"prisma": "^4.13.0",
"tailwindcss": "^3.3.3",
"typescript": "^5.3.0",
"zx": "7.0.8"
},
"engines": {
"node": "20.5.0"
}
}
@sergiodxa you are right, I forgot to update the paths in the mocks.
I think what @kevinreber means is another kind of issue, so I will close this issue for now.
By some miracle my issue just disappeared, didn't do anything special 😅
Feel free to ignore my comments 🙏 ⬆️ ⬆️