Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Implement imports #520

Closed
Closed
@izaera

Description

@izaera

Now that we have explicits exports (#516) we need to be able to import packages from a different OSGI bundle.

The "problem" is that there's something incorrect with the imports in bundler 2.x that we can fix for bundler 3.x but at the cost of introducing a big interoperability burden that will be with us until everybody migrates everything to bundler 3.x.

Let's see the problem. Imagine you create the react-portlet and react-provider projects (both at version 1.0.0) where the second exports the React framework (version 16.12.0) so that the first one imports it.

This would lead to the following module defined in the AMD loader:

Which would be imported by react-portlet by means of the .npmbundlerrc.

This looks good, but pay attention to the name of the module: it contains React's version (16.12.0) but not react-provider's version (1.0.0). Thus, if we deploy another version of react-provider (which is legal in OSGi) there will be a collision if it also contains [email protected].

We have never seen any problem related to this because the scenario is quite strange and even if it happened, the loader would choose one of the two [email protected] copies and, if both are the same (which is expected), nothing would happen.

However it is tempting to fix it for bundler 3.x, not only to avoid the error, but to simplify how the project is configured and built a lot (see next comment).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions