UNPKG

378 BJavaScriptView Raw
1// src/resolver.js
2module.exports = (path, options) => {
3 return options.defaultResolver(path, {
4 ...options,
5 // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
6 packageFilter: (pkg) => {
7 return {
8 ...pkg,
9 main: pkg.main || pkg.module
10 };
11 }
12 });
13};