-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
We are building an application that embeds plugins and we are using windows.
Plugins are separate js files built with:
browserify -x react -x ./common/react/Registry.js -d plugin1/Plugin1.js -o plugin1/bundle.js
where react and ./common/react/Registry.js are shared libraries, thus excluded from the plugins' bundle using the -x switch.
Main application is built with:
browserify -r react -r ./common/react/Registry.js -d app/app.js -o app/bundle.js
where react and ./common/react/Registry.js are made available for plugins using the -r switch
We are getting the following error when loading plugins:
Uncaught Error: Cannot find module '/common\react\Registry.js'
And have tracked it down to this line being generated in plugin's bundle.js:
...},{"../../../common/react/Registry":"/common\\react\\Registry.js","react":"react"}]},{},[1])
and when manually changed to:
...},{"../../../common/react/Registry":"/common/react/Registry.js","react":"react"}]},{},[1])
works fine. Seems that some parts of browserify use the unix style path separators but others use the OS path separators.
We have changed some lines in browserify index.js such that all paths use unix style path separators. We have added .replace(//g, '/') in all cases where path is used and it seems to have fixed the problem.
Should you require a test case, we would be happy to decompose the application down to a simple test case.
Attached is a diff of the index.js file.