Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Should recognize and handle UNC path on Windows correctly #23

Open
compulim opened this issue Aug 30, 2016 · 1 comment
Open

Should recognize and handle UNC path on Windows correctly #23

compulim opened this issue Aug 30, 2016 · 1 comment

Comments

@compulim
Copy link

compulim commented Aug 30, 2016

In pathToArray function, if the path looks like \\SERVER\folder\subfolder\abc.txt, it will throw MemoryFileSystemError(errors.code.EINVAL, path).

This is causing issues with Node.js >= 6.0.0 when bundling with Webpack on a UNC path.

Repro steps:

  1. Mapped \\SERVER\folder to Z:
  2. Setup a webpack.config.js that has an entry based on __dirname

Expected:
Webpack should bundle successfully

Actual:
Node.js >= 6.0.0: Webpack failed because pathToArray does not recognize UNC path
Node.js < 6.0.0: Bundle successfully

This is because under Node.js >= 6.0.0. Any JS modules on a mapped drive Z:, the __dirname will be relative to \\SERVER\folder\, instead of Z:\. And Webpack will fail because memory-fs could not recognize UNC path correctly.

There is currently no workaround as the new behavior on __dirname is consistent across all modules. The only way is to use process.cwd() instead but the solution is limited.

This is a blocking issue for Webpack bundler to run on Azure Web App with Node.js >= 6.0.0.

The correct behavior of pathToArray should be recognizing \\SERVER\folder and turn it into ['\\SERVER', 'folder'].

@sokra
Copy link
Member

sokra commented Sep 7, 2016

yep, it should handle these paths. PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants