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

bug: Cannot access uninitialized variable, only in Safari, works with dev build #5785

Closed
3 tasks done
Agular opened this issue May 21, 2024 · 3 comments
Closed
3 tasks done
Labels
ionitron: needs reproduction This PR or Issue does not have a reproduction case URL

Comments

@Agular
Copy link

Agular commented May 21, 2024

Prerequisites

Stencil Version

4.18.2 to 3.4.1

Current Behavior

In Safari (16.X, 17.X) on either Mac or iOS a white screen is shown. Page renders fine on Mac Chrome or on any browser in Windows.

In the console errors this error is thrown:
Unhandled Promise Rejection: ReferenceError: Cannot access uninitialized variable in index.js:1867 which refers to

Cstr = await CstrImport;

Expected Behavior

Page is rendered successfully in Safari. Or a more clear error message of the situation.

System Info

npx stencil info:
      System: node 20.11.0
    Platform: windows (10.0.19044)
   CPU Model: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz (8 cpus)
    Compiler: C:\**..**\ProjectName\node_modules\@stencil\core\compiler\stencil.js
       Build: 1716229673
     Stencil: 4.18.2
  TypeScript: 5.4.5
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.0

package.json dependencies
{
	"devDependencies": {
		"@ionic/core": "7.8.5",
		"@rollup/plugin-image": "^3.0.3",
		"@stencil-community/eslint-plugin": "^0.7.2",
		"@stencil/core": "4.18.2",
		"@types/jest": "^29.5.12",
		"@types/node": "^20.12.12",
		"@typescript-eslint/eslint-plugin": "^5.62.0",
		"@typescript-eslint/parser": "^5.62.0",
		"eslint": "^8.57.0",
		"eslint-config-prettier": "^8.10.0",
		"husky": "^8.0.3",
		"jest": "^29.7.0",
		"jest-cli": "^29.7.0",
		"prettier": "3.2.5",
		"puppeteer": "^19.11.1",
		"rollup-plugin-dotenv": "^0.5.1",
		"workbox-build": "^4.3.1"
	},
	"dependencies": {
		"@microsoft/signalr": "^7.0.14",
		"@stencil/redux": "^0.2.0",
		"axios": "^1.6.8",
		"chart.js": "^4.4.2",
		"chartjs-plugin-annotation": "^3.0.1",
		"date-fns": "^2.30.0",
		"date-fns-tz": "^2.0.1",
		"leaflet": "^1.9.4",
		"leaflet.markercluster": "^1.5.3",
		"redux": "^4.2.1",
		"redux-thunk": "^2.4.2",
		"shepherd.js": "^10.0.1",
		"swiper": "^8.4.7"
	}
}

Steps to Reproduce

I sadly do not have a MVP at this time.

Code Reproduction URL

Additional Information

I first had this problem with StencilJS 3.4.1 and Ionic 6. Also I thought that PR #5762 would help me debug this situation, but it does not help.

I have tried the following with various results:

  1. Updating StencilJS to 4.X and Ionic Framework to 7, did not work.
  2. Starting commenting huge chunks of code to get a MVP working state. I have achieved working states with this, but it seems that it kind of does not depend on any specific code, it just depends on how many components are rendered at the same time. I commented out components that I created inside the project.
  3. Deploying a dev build to production. This actually works surprisingly, but is not a final solution. My notice is that the files are bundled separately in the build and not bundled together.
  4. Configuring bundles in stencil.config.ts to simulate dev build effect by making sure most of the files are bundled separately. This is the current workaround for me, but is not stable since more custom components might reproduce the bug again.
  5. Adding browserlist configuration to packages.json with info from Ionic 6/7 migration guide, this did not work.
  6. Removing 3rd party dependencies e.g. axios, chart.js, date-fns, leaflet, redux, shepherd.js, swiper

For me it seems odd that the dev build works fine, but not the prod build. Additionally, currently seems that the bundling is the issue, but how?

@ionitron-bot ionitron-bot bot added the triage label May 21, 2024
@tanner-reits
Copy link
Member

@Agular I tried to reproduce this based on what you have in the summary, but didn't have any issues. When you get a chance, can you put together a reproduction case? Otherwise, we won't be able to verify or root cause the issue.

@tanner-reits tanner-reits added ionitron: needs reproduction This PR or Issue does not have a reproduction case URL and removed triage labels May 21, 2024
Copy link

ionitron-bot bot commented May 21, 2024

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

@Agular
Copy link
Author

Agular commented May 22, 2024

@tanner-reits
The team decided that we will probably drop this bug for now. I hope it was not too much of an inconvenience. I will close the issue myself.

@Agular Agular closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ionitron: needs reproduction This PR or Issue does not have a reproduction case URL
Projects
None yet
Development

No branches or pull requests

2 participants