-
Notifications
You must be signed in to change notification settings - Fork 1
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When trying to import a package sub-path like yargs/helpers, use-m fails to resolve the path.
Reproduction
const { use } = eval(await (await fetch('https://unpkg.com/use-m/use.js')).text());
// This works fine
const yargs = await use('yargs');
console.log('✓ yargs imported');
// This fails
const { hideBin } = await use('yargs/helpers');
console.log('✓ yargs/helpers imported');Error
Error: Failed to resolve the path to 'yargs/helpers' from '/Users/konard/.nvm/versions/node/v20.19.4/lib/node_modules/yargs-v-latest/helpers'.
Environment
- Node.js: v20.19.4
- OS: macOS (Darwin 24.6.0)
- use-m: latest from unpkg
Expected Behavior
Sub-path imports should work the same way they do with regular npm packages, where yargs/helpers resolves to the helpers submodule of yargs.
Actual Behavior
use-m fails to resolve the sub-path and throws an error.
Test Case
I've created a minimal reproduction case:
#!/usr/bin/env node
console.log('Testing yargs with use-m...\n');
const { use } = eval(await (await fetch('https://unpkg.com/use-m/use.js')).text());
console.log('✓ use-m loaded successfully');
try {
console.log('\n1. Testing yargs import...');
const yargs = await use('yargs');
console.log('✓ yargs imported successfully');
} catch (error) {
console.error('✗ Failed to import yargs:', error.message);
process.exit(1);
}
try {
console.log('\n2. Testing yargs/helpers import...');
const { hideBin } = await use('yargs/helpers');
console.log('✓ yargs/helpers imported successfully');
} catch (error) {
console.error('✗ Failed to import yargs/helpers:', error.message);
process.exit(1);
}
console.log('\n✅ All imports successful!');Workaround
For now, I'm parsing arguments manually instead of using yargs/helpers.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working