This repository has been archived by the owner on May 29, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: get real path from
__filename
instead of __dirname
(NS
)
Without this fix, this plugin doesn't work if your node_modules tree is made up of directories, but your files are symlinks. It's admittedly a weird environment, but that's the environment that the Bazel build system runs code in, which is the build system we use at Dropbox. This is the bug: - index.js is called from the runfiles directory, and it uses the realpath of its directory as the key for a function on the loaderContext object. - loader.js is called from the bazel-bin/npm directory outside of its runfiles (because Webpack escapes the runfiles when it calls loaders). It uses the realpath of its directory as a key on the loaderContext object, but because it's in a different directory from index.js, it can't find the function set on the loaderContext by index.js. The fix is to get the realpath of the filename instead of the directory so that both files point to the same place.
- Loading branch information