liferay / liferay-frontend-projects

A monorepo containing assorted Frontend Infrastructure Team projects
Other
66 stars 67 forks source link

Unsatisfied dependency: *.cjs found in module #1202

Open itryapitsin2 opened 2 months ago

itryapitsin2 commented 2 months ago

Issue type (mark with x)

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/toolkit@2.2.0/dist/cjs/redux-toolkit.development.cjs of @testapp$reduxjs/toolkit@2.2.0/dist/cjs/index

and

Uncaught (in promise) Error: Unsatisfied dependency: ./redux-toolkit.development.cjs found in module @testapp$reduxjs/toolkit@2.2.0/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.

bryceosterhaus commented 2 months ago

Hey, thanks for opening this. Just FYI, dince this code is community-maintained, things can go slower than expected because there is no SLA in place. If you have a support contract for any of the Liferay products use the official channels to report your issue. In any case, if you decide to file the issue here, remember that all information you can gather about the issue and the reason why it is happening will help a lot in its resolution because otherwise it involves a lot of effort just to find out if it is a bug or what can be causing it.