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

fix(stream/web): default export with variable name #1519

Closed
wants to merge 1 commit into from
Closed

fix(stream/web): default export with variable name #1519

wants to merge 1 commit into from

Conversation

talentlessguy
Copy link
Contributor

Importing stream/web.ts like this:

import streams from 'https://deno.land/[email protected]/node/stream/web.ts'

results in this:

error: Uncaught SyntaxError: The requested module 'https://deno.land/[email protected]/node/stream/web.ts' does not provide an export named 'default'
import streams from 'https://deno.land/[email protected]/node/stream/web.ts'

this PR fixes this, by using a variable name for a default export:

$ deno eval 'import streams from "https://denopkg.com/talentlessguy/deno_std@feat-stream-web-default-export-with-var-name/node/stream/web.ts"; console.log(streams)'
{
  ReadableStream: [Function: ReadableStream],
  ReadableStreamDefaultReader: [Function: ReadableStreamDefaultReader],
  ReadableByteStreamController: [Function: ReadableByteStreamController],
  ReadableStreamDefaultController: [Function: ReadableStreamDefaultController],
  TransformStream: [Function: TransformStream],
  TransformStreamDefaultController: [Function: TransformStreamDefaultController],
  WritableStream: [Function: WritableStream],
  WritableStreamDefaultWriter: [Function: WritableStreamDefaultWriter],
  WritableStreamDefaultController: [Function: WritableStreamDefaultController],
  ByteLengthQueuingStrategy: [Function: ByteLengthQueuingStrategy],
  CountQueuingStrategy: [Function: CountQueuingStrategy],
  TextEncoderStream: [Function: TextEncoderStream],
  TextDecoderStream: [Function: TextDecoderStream]
}

@kt3k
Copy link
Member

kt3k commented Nov 4, 2021

Thank you for the fix, but the current syntax should be already working.

$ deno eval 'import streams from "https://raw.githubusercontent.com/denoland/deno_std/main/node/stream/web.ts"; console.log(streams)'

We merged #1430 after the release of 0.113.0, that's why 0.113.0 doesn't work for default import

@talentlessguy
Copy link
Contributor Author

closing this PR then

@talentlessguy talentlessguy deleted the feat-stream-web-default-export-with-var-name branch November 4, 2021 07:46
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