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

[BUG] Cannot destructure property 'output' #42

Open
1 task done
resynth1943 opened this issue Dec 14, 2020 · 3 comments · May be fixed by #43
Open
1 task done

[BUG] Cannot destructure property 'output' #42

resynth1943 opened this issue Dec 14, 2020 · 3 comments · May be fixed by #43
Labels
bug Something isn't working

Comments

@resynth1943
Copy link

resynth1943 commented Dec 14, 2020

Describe the bug

When using the CLI, I have encountered the following runtime error.

deno run --unstable --allow-read --allow-write --allow-env --allow-net https://deno.land/x/denopack@0.10.0/cli.ts --config ./bundle.config.ts

error: Uncaught (in promise) TypeError: Cannot destructure property 'output' of 'opts' as it is undefined.
  const { output: _outputOpts, ...rollupOpts } = opts;
                  ^
    at mergeOptions (options.ts:64:19)
    at runBundler (runBundler.ts:30:53)

To Reproduce
Steps to reproduce the behavior:

  1. Run the above command.
  2. Error! 👻

Expected behavior

I expected it to work. 😛

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Fedora 33
  • Deno version: see below.
deno 1.5.4 (bc79d55, release, x86_64-unknown-linux-gnu)
v8 8.8.278.2
typescript 4.0.5
  • denopack version: 0.10.0

Checklist

  • I am using Deno version 1.2.0 or higher
@resynth1943 resynth1943 added the bug Something isn't working label Dec 14, 2020
@resynth1943
Copy link
Author

resynth1943 commented Dec 14, 2020

EDIT: I see the error. My Rollup configuration file is actually empty.

The error seems to occur here:

const { output: _outputOpts, ...rollupOpts } = opts;

A possible solution would be to check if opts isn't undefined without destructuring it~~, but I'm unsure as to why it wouldn't be defined (especially when it's pointed at a valid configuration file)~~.

So mergeOptions is called here:

const [rollupOpts, outputOpts, outputDir] = await mergeOptions(

It seems like you aren't checking the value of the import([...]) call before destructuring it. One possible solution would be to throw if a --config value has been provided, and one of the following apply:

  • the path doesn't exist
  • the exported value isn't correct

Would you like me to submit a PR?

@resynth1943
Copy link
Author

P.S. nice code-base, keep it up! Love seeing clean code in the wild. ❤️

@resynth1943

This comment has been minimized.

@resynth1943 resynth1943 linked a pull request Dec 14, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant