preact project import fails on different OS

Viewed 48

I'm running a preact project with preact build and doing an import as follows:

import PresenceToggleAlert from 'async?name=presenceToggleAlert!components/alerts/PresenceToggleAlert';

My actual route is components/alerts/presenceToggleAlert (without capital P )

I have tested on MacOS, ubuntu and windows and works perfectly, but at the moment my jenkins server the casing suddenly becomes a problem, throwing an error as follows:

āœ– ERROR ./components/alerts/alertContainer/index.js
Module not found: Error: Can't resolve 'components/alerts/PresenceToggleAlert' in './src/components/alerts/alertContainer'
 @ ./components/alerts/alertContainer/index.js 39:0-103 131:22-41
 @ ./components/framework/page/index.js
 @ ./index.js

Does anybody know what can be the problem? I can't figure out why does it work locally but not on the remote machine.

My server runs on CentOS 6.5 and has Jenkins Version 2.263.4

1 Answers

Linux filesystem (CentOS in you case) is case-sensitive where as Windows in case-insensitive. In case of MacOS, it depends on what you choose at installation time.

Change your code to lowercase p since that is where the actual file lies. So it should be

import PresenceToggleAlert from 'async?name=presenceToggleAlert!components/alerts/presenceToggleAlert';

Or, if you want to rename the file itself then, on Window, you cannot simply change the case. It would be typically ignored by Git and there won't be anything to commit. Commit it in two steps. First change the file to some temporary name. Then do the commit. Again rename the temporary file to the actual file you want and do the commit again. Additionally, before pushing your changes, you can simply squash you commits into one commit.

Related