Permalink
Browse files

feat(bundler): support module resolution for lerna hoisting

When standard resolution failed, try app's local folder.
  • Loading branch information...
huochunpeng committed Dec 29, 2018
1 parent 76dae4b commit dabc8b985390a90b587d8b5a9c887d45ddfb3833
@@ -1,6 +1,6 @@
#!/usr/bin/env node
'use strict';
const resolve = require('../lib/resolve');
const resolve = require('resolve');

const semver = require('semver');
const nodeVersion = process.versions.node;
@@ -14,7 +14,13 @@ exports.couldMissGulpPreprocess = function(id) {
// require.resolve(packageName) cannot resolve package has no main.
// for instance: font-awesome v4.7.0
// manually try resolve paths
const PACKAGE_PATHS = require.resolve.paths('not-core/');
const PACKAGE_PATHS = [
// normal search from cli
...require.resolve.paths('not-core/'),
// additional search from app's folder, this is necessary to support
// lerna hoisting where cli is out of app's local node_modules folder.
...require('resolve/lib/node-modules-paths')(process.cwd(), {})
];

// resolve npm package path
exports.resolvePackagePath = function(packageName) {

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit dabc8b9

Please sign in to comment.