Skip to content

Incompatible with Vite due to transitive dep (ember-get-config) which uses require #432

Description

@jelhan

Describe the bug

ember-cli-clipboard cannot be used in an app build with Vite.

The following error is thrown:

Uncaught TypeError: window.require is not a function

The error is caused by ember-get-config, which relies on require here: https://github.com/mansona/ember-get-config/blob/552ce14df18a68481f4a8bb8528fa7b95e75b5e9/addon/index.js#L6

ember-cli-clipboard pulls in ember-get-config through its dependency on ember-arg-type:

$ pnpm why ember-get-config

devDependencies:
ember-cli-clipboard 1.3.0
└─┬ ember-arg-types 1.1.0
  └── ember-get-config 2.1.1

To Reproduce

I haven't tested this reproduction myself. But I assume it can be reproduced in any newly created app with Ember CLI v6.8 when adding ember-cli-clipboard to it.

Expected behavior

An app using ember-cli-clipboard can be built with Vite.

Additional context

I see 3 options:

  1. Improve ember-get-config to not rely on require anymore.
  2. Refactor ember-arg-types to not depend on ember-get-config anymore.
  3. Refactor ember-cli-clipboard to not depend on ember-arg-types anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions