Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

monorepo error with webpack alias #42

Open
kompolom opened this issue Jun 4, 2024 · 0 comments
Open

monorepo error with webpack alias #42

kompolom opened this issue Jun 4, 2024 · 0 comments

Comments

@kompolom
Copy link

kompolom commented Jun 4, 2024

Hello! We have monorepo with some projects and packages. Token defined in shared package but bind to value in application. Applications is not defined as npm workspace, so they have own dependency tree and node_modules in application not the same as node_modules in packages. So we use webpack resolve aliases to dedupe some packages. We use simply function to resolve package relative to application root:

import { dirname, join } from "node:path";
import { createRequire } from "node:module";

const require = createRequire(import.meta.url);
export const getAbsolutePath = (value) => dirname(require.resolve(join(value, 'package.json')));

This code works with many libraries, but get error with brandi: 'ERR_PACKAGE_PATH_NOT_EXPORTED'

I think its enough to allow package.json export in package.json 'exports' field to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant