Skip to content

A weird warning? Can't resolve 'remote-component.config.js'  #71

@addlistener

Description

@addlistener

The problem

The remote components loads successfully, however I get the following error in terminal

 ⚠ ./node_modules/@paciolan/remote-component/dist/getDependencies.js
Module not found: Can't resolve 'remote-component.config.js' in './node_modules/@paciolan/remote-component/dist'

Import trace for requested module:
./node_modules/@paciolan/remote-component/dist/getDependencies.js
./node_modules/@paciolan/remote-component/dist/index.js

More details

The complaining code

var getDependencies = function () {
    try {
        // eslint-disable-next-line @typescript-eslint/no-var-requires
        return exports.ensureRemoteComponentConfig(require("remote-component.config.js"));
    }
    catch (err) {
        // istanbul ignore next: This is just too impossible to test
        if (!cannotFindModule(err)) {
            throw err;
        }
        return {};
    }
};
exports.getDependencies = getDependencies;
//# sourceMappingURL=getDependencies.js.map

This is how I've been using remote-component

import { resolve } from '../../../../../remote-component.config.cjs';

// @ts-expect-error it's cjs code
const requires = createRequires(resolve);
export const useRemoteComponent = createUseRemoteComponent({ requires });

I tried to change cjs to js but the warning persists. So I changed it back. And since I've loaded remote-component manually why the code tries to load the config.reoslve again?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions