Skip to content

[web] Anonymous define() in CanvasKit's JS #58428

@deakjahn

Description

@deakjahn

I know from dart-lang/sdk#33979 that you don't necessarily intend to rely on RequiresJS in the future (although it's not clear whether this applies to CanvasKit or not). Your call, no problem with that. But as long as you do, please, fix the JS source to contain a standard AMD define(). The omission of the name now makes it impossible to use RequireJS (even if we bring our own copy) in Flutter Web/CanvasKit apps.

Steps to Reproduce:

  1. Grab any Flutter Web app, or create a new one.
  2. Copy require.js or almond.js to the assets dir.
  3. Include a <SCRIPT> tag to it in Index.html.
  4. Run with CanvasKit enabled.

Actual results:

Using requireJS:

Uncaught Error: Mismatched anonymous define() module: function() { return CanvasKitInit; }

Using almond.js:

almond.js:414 Uncaught Error: See almond README: incorrect module build, no module name
at define (almond.js:414)
at canvaskit.js:333
Doc
[√] Flutter (Channel beta, 1.18.0-11.1.pre, on Microsoft Windows [Version 10.0.18363.836], locale en-US)
    • Flutter version 1.18.0-11.1.pre at E:\Android\flutter-beta
    • Framework revision 2738a1148b (3 weeks ago), 2020-05-13 15:24:36 -0700
    • Engine revision ef9215ceb2
    • Dart version 2.9.0 (build 2.9.0-8.2.beta)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    • Android SDK at e:\Android\Sdk
    • Platform android-29, build-tools 29.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • CHROME_EXECUTABLE = e:\Android\chrome.bat

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (2 available)
    • Web Server • web-server • web-javascript • Flutter Tools
    • Chrome     • chrome     • web-javascript • Google Chrome 83.0.4103.61

• No issues found!

Metadata

Metadata

Labels

assigned for triageissue is assigned to a domain expert for further triagee: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.found in release: 1.19Found to occur in 1.19has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions