Skip to content

Support ESModules for proxy.config file #21623

@ranwahle

Description

@ranwahle

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

Angular CLI now supports proxy configuration for both .json and .js extensions, however, trying to have a proxy with .mjs file, in order to have the javascript file importing other modules, produces an error message.

A clear and concise description of the problem or missing capability...

Describe the solution you'd like

I've discovered that using dynamic import instead of require on addProxyConfig function on dev-server.ts file, does this work.

If you have a solution in mind, please describe it.

Describe alternatives you've considered

I have searched for some flags that will allow me to do so and haven't found any, and the only solution I can find is to go to require.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions