Conversation
|
What do you think about adding It's supported in both browsers and node, and would be a replacement for |
The plan is for RN (or Expo) to define properties using the Metro could define some more defaults though.. |
| __getImportMetaProperties: module => { | ||
| return { | ||
| url: new URL(String(module.id), 'metro://'), | ||
| }; |
There was a problem hiding this comment.
so this code will be added to react native itself?
There was a problem hiding this comment.
Yep, similar to how the framework defines async imports, eg:
Currently, Metro leaves `import.meta` accesses untransformed, but provides no `import` pseudoglobal, so (unless polyfilled) this throws at runtime. `import.meta` is [specified](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-meta-properties) as a writable null-proto object. Though the spec is silent on any properties, it provides a mechanism ([`HostGetImportMetaProperties`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-hostgetimportmetaproperties)) for hosts to set properties, given a module object. Eg: `url`, `resolve` are defined by Node.js and browsers (and notably `env` by Vite). We emulate that mechanism here with the `__getImportMetaProperties(module) => {[key: string]: mixed}` optional, framework-defined global function.
|
any progress on this? |
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Metro 0.82+ (Expo 53+) enables package.json exports by default. When source uses ESM import syntax, Metro asserts the 'import' condition, which resolves jotai to its .mjs build containing import.meta.env.MODE — a Vite-ism. Metro's web output is a plain <script> (not type=module), so the browser throws a SyntaxError before any app code runs. babel-preset-expo gained unstable_transformImportMeta in SDK 53 as an opt-in to compile import.meta away at build time. Enabling it here is the correct fix; no metro.config.js changes needed. Tracked: pmndrs/jotai#3041 Metro fix in progress: react/metro#1494 Generated-by: OpenCode Model: amazon-bedrock/anthropic.claude-sonnet-4-6
Currently, Metro leaves
import.metaaccesses untransformed, but provides noimportpseudoglobal, so (unless polyfilled) this throws at runtime.import.metais specified as a writable null-proto object. Though the spec is silent on any properties, it provides a mechanism (HostGetImportMetaProperties) for hosts to set properties, given a module object. Eg:url,resolveare defined by Node.js and browsers (and notablyenvby Vite).We emulate that mechanism here with the
__getImportMetaProperties(module) => {[key: string]: mixed}optional, framework-defined global function.