Skip to content

Test more node versions #280

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

Merged
merged 1 commit into from
Mar 26, 2022
Merged

Conversation

bjornstar
Copy link
Collaborator

I'm not sure which version added the emitWarning method, but at least on node v12.16 it doesn't work.

throw err;
} catch (error) {
if (error.code !== 'ERR_UNKNOWN_FILE_EXTENSION') throw error;
return require('get-package-type')(filePath).then(format => ({ format, source: null }));
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't break anything, but getFormat's return value should only have the format key.

lib/index.js Outdated
Comment on lines 101 to 116

const legacyPrefix = semver.satisfies(process.version, '<16.12.0') ? 'legacy-' : '';
const loaderURL = pathToFileURL(resolveMain(localPath(`${legacyPrefix}loader.mjs`)));
const experimentalPrefix = semver.satisfies(process.version, '>=12.11.1')
? 'experimental-'
: '';

args.push(`--${experimentalPrefix}loader=${loaderURL.href}`);

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the code golf here might be overfitting to what the loader options currently are. I'm concerned that when the loader option's name inevitably changes again in the future that all of this string concatenation won't be a maintainable approach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I just get annoyed when both sides of an if statement have the same function call with different arguments.

@bjornstar bjornstar force-pushed the test-more-node-versions branch from 6f22025 to 9bfee6d Compare March 26, 2022 18:28
@bjornstar bjornstar merged commit 5d07f00 into fgnass:master Mar 26, 2022
@bjornstar bjornstar deleted the test-more-node-versions branch March 26, 2022 18:34
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.

2 participants