Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error after merging #1032 #997

Open
shankari opened this issue Oct 3, 2023 · 7 comments
Open

Build error after merging #1032 #997

shankari opened this issue Oct 3, 2023 · 7 comments

Comments

@shankari
Copy link
Contributor

shankari commented Oct 3, 2023

While building the apps after merging
e-mission/e-mission-phone#1032
I get the following error

$ npm run build-dev

> gov.nrel.cims.openpath@1.5.2 build-dev
> npx webpack --config webpack.dev.js && npx cordova build

assets by status 1.84 MiB [cached] 9 assets
asset bundle.js 35.2 MiB [emitted] (name: main)
orphan modules 124 KiB [orphan] 55 modules
runtime modules 2.63 KiB 10 modules
...
ERROR in ./www/js/onboarding/WelcomePage.tsx 97:12-50
Module not found: Error: Can't resolve '../../../resources/icon.png' in '/Users/kshankar/in-house/openpath-phone/www/js/onboarding'
resolve '../../../resources/icon.png' in '/Users/kshankar/in-house/openpath-phone/www/js/onboarding'
  using description file: /Users/kshankar/in-house/openpath-phone/package.json (relative path: ./www/js/onboarding)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /Users/kshankar/in-house/openpath-phone/package.json (relative path: ./resources/icon.png)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Users/kshankar/in-house/openpath-phone/resources/icon.png doesn't exist
      .web.js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/kshankar/in-house/openpath-phone/resources/icon.png.web.js doesn't exist
      .jsx
        Field 'browser' doesn't contain a valid alias configuration
        /Users/kshankar/in-house/openpath-phone/resources/icon.png.jsx doesn't exist
      .tsx
        Field 'browser' doesn't contain a valid alias configuration
        /Users/kshankar/in-house/openpath-phone/resources/icon.png.tsx doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /Users/kshankar/in-house/openpath-phone/resources/icon.png.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/kshankar/in-house/openpath-phone/resources/icon.png.js doesn't exist
      as directory
        /Users/kshankar/in-house/openpath-phone/resources/icon.png doesn't exist
 @ ./www/js/onboarding/OnboardingStack.tsx 4:0-40 18:44-55
 @ ./www/js/App.tsx 31:0-59 129:40-55
 @ ./www/js/ngApp.js 26:0-24 76:40-43
 @ ./www/index.js 5:0-23

Worked around it by copying an icon

$ cp resources/app_store_icon_1024_1024.png resources/icon.png

But it is not clear why this broke suddenly. Was the icon.png present but removed by the PR?
It did remove several files, but I don't recall icon.png among them.

@JGreenlee
Copy link

resources/icon.png was not removed in #1032. I don't know why it was missing there.

@shankari
Copy link
Contributor Author

shankari commented Oct 3, 2023

how were we referencing the icon before? Maybe that is what changed?

@JGreenlee
Copy link

It used to be img/icon.png (which didn't exist in the file structure). Now it's resources/icon.png (which does exist).

Where was img/icon.png coming from before? One challenge here is that all resources need to be present at the time of bundling - we can not bundle JS and then just rely on some separate resources being available at runtime.

@shankari
Copy link
Contributor Author

I poked around the internal repo, and as far as I can make out, img/icon.png was a manually copied over version of the icon.

$ ls -al www/img/icon.png
-rw-r--r--@ 1 kshankar  staff  9970 Jun 15  2022 www/img/icon.png

and

$ git status www/img/icon.png
On branch onboarding_routing_sept_2023
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	www/img/icon.png

Since it was never checked in, there is no history and the reasons are lost in the mists of time

@shankari
Copy link
Contributor Author

wait, there is history for the place it was used.

img/icon.png was added in
e-mission/e-mission-phone@e8f5b71

which was copied over from https://github.com/e-mission/e-mission-base
which does have an icon.png
https://github.com/e-mission/e-mission-base/tree/master/www/img

So basically, I copied it over from emTripLog, and because it used img/icon.png, I copied the icon to create a non-checked in copy, and then never actually checked it in or changed the original file path.

I think it's fine to change it to resources/icon.png
But the icon needs to be created properly...

@shankari
Copy link
Contributor Author

this is fairly bizarre. There is an icon.png here
https://github.com/e-mission/e-mission-phone/blob/onboarding_routing_sept_2023/resources/icon.png
but not in the local repo

$ git status resources/icon.png
On branch onboarding_routing_sept_2023
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	resources/icon.png

@shankari
Copy link
Contributor Author

shankari commented Oct 25, 2023

Ah I removed it internally because the icon requirements for android and iOS are slightly different, so we have very slightly icons

-    <icon src="resources/icon.png" />
+    <icon src="resources/ios/icon.png" platform="ios"/>
+    <icon src="resources/android/icon.png" platform="android"/>

@JGreenlee in a future fix, we should probably split the open-source version to also have iOS and android versions to avoid having these minor differences between repos

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

No branches or pull requests

2 participants