diff --git a/README.md b/README.md index 6b64e42..e9461b3 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,13 @@ Default: `undefined` npm registry to install the package from. By default it uses the default npm registry. +#### resolve + +Type: `string` `string[]`
+Default: `undefined` + +Extra folders to resolve local node_modules from. + ## Contributing 1. Fork it! diff --git a/cli.js b/cli.js index 12bc03e..aa44aa2 100755 --- a/cli.js +++ b/cli.js @@ -123,6 +123,10 @@ cli .option('--analyze', 'Analyze bundled files') .option('--port ', 'Port to start analyze on. Defaults to 8888') .option('--registry ', 'npm registry URL to install from') + .option( + '--resolve ', + 'Extra folders to resolve local node_modules from' + ) .example(` package-size react,react-dom`) .example(` package-size styled-jsx/style --externals react`) .example(` package-size ./dist/my-bundle.js`) diff --git a/lib/index.js b/lib/index.js index d789ab7..a608ce5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -95,6 +95,10 @@ module.exports = co.wrap(function*(name, opts = {}) { if (yarnGlobal.inDirectory(__dirname)) { config.resolve.modules.push(path.join(yarnGlobal.getDirectory())) } + + if (opts.resolve) { + config.resolve.modules = config.resolve.modules.concat(opts.resolve) + } if (isCwd) { config.resolve.modules.unshift(path.join(process.cwd(), 'node_modules'))