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

feat(cli): use --prefer-local option to link external `node_modules #1117

Merged
merged 3 commits into from
Mar 2, 2025

Conversation

antongolub
Copy link
Collaborator

@antongolub antongolub commented Mar 2, 2025

closes #1116

const cwd = tmpdir()
const external = tmpdir()
await fs.outputJson(path.join(external, 'node_modules/a/package.json'), {
  name: 'a',
  version: '1.0.0',
  type: 'module',
  exports: './index.js',
})
await fs.outputFile(
  path.join(external, 'node_modules/a/index.js'),
  `
export const a = 'AAA'
`
)
const script = `
import {a} from 'a'
console.log(a);
`
const out =
  await $`node build/cli.js --cwd=${cwd} --prefer-local=${external} --test <<< ${script}`
assert.equal(out.stdout, 'AAA\n')
  • Tests pass
  • Appropriate changes to README are included in PR

@antongolub antongolub requested a review from antonmedv March 2, 2025 14:15
@antonmedv antonmedv merged commit 539130a into google:main Mar 2, 2025
24 checks passed
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.

Add a flag to include a user defined node_modules location.
2 participants