webpack-contrib / expose-loader

Expose Loader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify/improve config usages in readme

WiseBird opened this issue · comments

Readme suggests require.resolve as a way to get path to a module, but webpack's resolution differs from node's one (e.g. webpack supports module property).

Please update readme with info about how to properly get module path.

Is there a straightforward way to resolve the path to the module from the package name? I'm using something like require.resolve('some-package/full/path/to/esm.js') but this is fragile against the package authors changing the directory structure, for example.

It seems difficult because the final webpack resolve.mainFields might not be known when the expose-loader is configured.

Changing public structure of package is a breaking change and should be done only for major releases, other improvements done in master, feel free to open a new issues if you still have a problems with docs, we will improve it