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

Conditionally use esm package #499

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link

@NullVoxPopuli NullVoxPopuli commented Jun 3, 2022

Resolves: #498

Tested on: https://stackblitz.com/github/nullvoxpopuli/broccoli/tree/remove-esm
(for which the esm package does not work at all)

@NullVoxPopuli NullVoxPopuli changed the title Remove esm package Conditionally use esm package Jun 4, 2022
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review June 4, 2022 14:20
@@ -1,8 +1,5 @@
import path from 'path';
import findup from 'findup-sync';
import esm from 'esm';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main fix here. importing esm cannot happen in module-space because of the hax it employs.

Comment on lines +53 to +59
} catch {
// eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-missing-require
const esm = require('esm');
const esmRequire = esm(module);

brocfile = esmRequire(brocfilePath);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check the specific error code and only fallback to the esm version if we don't have some other (userland) error?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't get this project to run at all locally, so so I can't see what error is thrown

@NullVoxPopuli
Copy link
Author

I can confirm that removing the esm code from broccoli allows me to make progress at: https://stackblitz.com/github/ember-cli/editor-output/tree/stackblitz-app-output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove esm package
2 participants