-
Notifications
You must be signed in to change notification settings - Fork 5
[resolver] use webpack-resolver for core logic #15
Conversation
index.js
Outdated
pluginPaths: [], | ||
pluginDirs: [ | ||
'../kibana/plugins', | ||
'../kibana/core_plugins', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path is wrong, it's kibana/src/core_plugins
also observe the kibanaPath
recurse up paths until a package.json file with a matching name is found, if pluginName is provided. throw if none is found
index.js
Outdated
const matches = glob.sync(globPattern, globOptions); | ||
debug(`checking in ${checkPath}, matched ${matches.length}`); | ||
const getRootPackageDir = (dir) => { | ||
const pkgFile = pkgUp.sync(dir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need pkgUp
for this? We're basically already doing what it is doing in this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start at the path and recursively look for package.json files that match the rootPackageName
or just exist if there isn't a rootPackageName
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you're right, we kinda don't...
index.js
Outdated
}; | ||
|
||
/* | ||
* Resolves the path to Kibana, either from default setting or config | ||
*/ | ||
function getKibanaPath(config, file, rootPath) { | ||
function getKibanaPath(config, rootPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename rootPath
to projectRoot
?
This PR removes the custom resolver logic and instead wraps the
eslint-import-resolver-webpack
module, feeding it a custom configuration so that the resolver behaves like Kibana's internal version of webpack.This also adds three settings:
rootPackageName
: the name of the package that should be considered the "root" package, useful for packages like Kibana which contain multiple packages so that a file likesrc/core_plugins/console/index.js
resolves as a child of kibana rather than the console plugin package.pluginPaths
: an array of paths to plugin folderspluginDirs
: an array of paths (relative to the project root) that contain multiple plugin folders