Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 36.4k
cli: --dev flag for development exports resolution condition#33171
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -33,6 +33,7 @@ const { sep } = require('path'); | ||
| const preserveSymlinks = getOptionValue('--preserve-symlinks'); | ||
| const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); | ||
| const development = getOptionValue('--dev'); | ||
| const typeFlag = getOptionValue('--input-type'); | ||
| const { URL, pathToFileURL, fileURLToPath } = require('internal/url'); | ||
| const { | ||
| @@ -46,7 +47,11 @@ const { | ||
| ERR_UNSUPPORTED_ESM_URL_SCHEME, | ||
| } = require('internal/errors').codes; | ||
| const DEFAULT_CONDITIONS = ObjectFreeze(['node', 'import']); | ||
| const DEFAULT_CONDITIONS = ObjectFreeze([ | ||
guybedford marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| 'node', | ||
| 'import', | ||
| ...development ? ['development'] : [] | ||
| ]); | ||
| const DEFAULT_CONDITIONS_SET = new SafeSet(DEFAULT_CONDITIONS); | ||
| function getConditionsSet(conditions) { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import '../common/index.mjs'; | ||
| import { path } from '../common/fixtures.mjs'; | ||
| import { strictEqual } from 'assert'; | ||
| import { spawnSync } from 'child_process'; | ||
| { | ||
| const output = spawnSync(process.execPath, [path('/pkgexports-dev.mjs')]); | ||
| console.log(output.stderr.toString()); | ||
| strictEqual(output.stdout.toString().trim(), 'production'); | ||
| } | ||
| { | ||
| const output = spawnSync(process.execPath, | ||
| ['--dev', path('/pkgexports-dev.mjs')]); | ||
| strictEqual(output.stdout.toString().trim(), 'development'); | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { fileURLToPath } from 'url'; | ||
| import { createRequire } from 'module'; | ||
| import { strictEqual, AssertionError } from 'assert'; | ||
| const require = createRequire(fileURLToPath(import.meta.url)); | ||
| const requireVal = require('pkgexports-dev'); | ||
| (async () => { | ||
| const { default: importVal } = await import('pkgexports-dev'); | ||
| strictEqual(requireVal, importVal); | ||
| console.log(importVal); | ||
| })(); |
Uh oh!
There was an error while loading. Please reload this page.