Skip to content

require.js added to global namespace, when serving via dartdevc #33979

@yury-yufimov

Description

@yury-yufimov

This is one for discussion, I think.

While migrating to Dart2.0 (2.0.0-dev.67.0), we faced following issue:
DDC adds <script defer="" src="/packages/$sdk/dev_compiler/amd/require.js"></script> to page, which defines global functions require and define.
That fact affects some third-party libraries, that are also imported to project.
If such library sees global define function, it defines new module, otherwise - set global variable.
Problem is, we don't use requirejs in production environment.
Of course, we can add condition: load library via requirejs in dev-environment, by script adding - in prod one.
But I think, that can be a common problem for large products.

Another possible solution: move ddc's requirejs to some namespace...

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dev-compiler-buildweb-dev-compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions