Skip to content

Unsatisfied dependency: *.cjs found in module Β #1202

Open
@itryapitsin2

Description

@itryapitsin2

Issue type (mark with x)

  • πŸ€” Question
  • πŸ› Bug report
  • 🎁 Feature request
  • πŸ€·β€β™€οΈ Other

Description

When I try to use some libraries which has files with .cjs-extension as a NodeJS dependecy. For example, @reduxjs/toolkit.
Liferay throws the error in runtime

Missing dependency @testapp$reduxjs/[email protected]/dist/cjs/redux-toolkit.development.cjs of @testapp$reduxjs/[email protected]/dist/cjs/index

and

Uncaught (in promise) Error: Unsatisfied dependency: ./redux-toolkit.development.cjs found in module @testapp$reduxjs/[email protected]/dist/cjs/index

image

An example of my code in testapp

import { configureStore, combineReducers } from '@reduxjs/toolkit'

const rootReducer = combineReducers({
...
});
const store = configureStore({
reducer: rootReducer,
});
...

I've tested another libraries. For example, MobX. It has the same problem when find .cjs file.

Other information (environment, versions etc):
I verified this problem with:
Liferay 7.3 GA5
liferay-npm-bundler: 2.31.2
@reduxjs/toolkit 2.2.0
NodeJS 16.16.0
NPM 6.14.4
Other versions of NodeJS and npm have the problem also.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions