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] file beginning with _ generates in build/chrome-mv3-dev, breaking development #830

Open
2 of 3 tasks
Fiattarone opened this issue Nov 24, 2023 · 3 comments
Open
2 of 3 tasks
Labels
bug Something isn't working

Comments

@Fiattarone
Copy link

Fiattarone commented Nov 24, 2023

What happened?

Load Package Error in chrome:

Failed to load extension from: /../../build/chrome-mv3-dev. Cannot load extension with file or directory name empty.f6fb76d8.js. Filenames starting with "" are reserved for use by the system.

I can see _empty.f6fb76d8.js being generated in the aforementioned dir, deleting/renaming it doesn't help. Tried deleting the whole of chrome-mv3-dev and it regenerates with the same breaking file.

Looks like this is some kind of issue with plasmo, as I've gone back several commits that were tested tried and true and the _empty is still being generated upon pnpm dev

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contribution

  • I would like to fix this BUG via a PR

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@Fiattarone Fiattarone added the bug Something isn't working label Nov 24, 2023
@Fiattarone
Copy link
Author

Fiattarone commented Nov 25, 2023

It actually looks like this is due to a dependency of mine called pdfjs-dist... no idea how to begin debugging it though as no other errors are being thrown.

Friend of mine suggested downloading the lib to my project folder directly as a workaround, but I really try avoiding suggestions that look like they fell out of the early 2000's and bumped their head.

@the-wc
Copy link

the-wc commented Nov 28, 2023

I've encountered the same error @Fiattarone with pdfjs-dist. Moreover, if you try to build with code like this:

const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
  const response = await fetch(url)
  const arrayBuffer = await response.arrayBuffer()
  // This line below causes the error.
  const loadingTask = pdfJS.getDocument({ data: arrayBuffer })
}

You'll receive:

  × await isn't allowed in non-async function
       ╭─[16181:1]
 16181 │ /\*\*\*\*\*\*/ // Load entry module and return exports
 16182 │ /\*\*\*\*\*\*/ // This entry module used 'module' so it can't be inlined
 16183 │ /\*\*\*\*\*\*/ var \_\_webpack\_exports\_\_ = \_\_webpack\_require\_\_(907);
 16184 │ /\*\*\*\*\*\*/ \_\_webpack\_exports\_\_ = globalThis.pdfjsLib = await (globalThis.pdfjsLibPromise = \_\_webpack\_exports\_\_);
       ·                                                            ─
 16185 │ /\*\*\*\*\*\*/ var \_\_webpack\_exports\_\_AbortException = \_\_webpack\_exports\_\_.AbortException;
 16186 │ /\*\*\*\*\*\*/ var \_\_webpack\_exports\_\_AnnotationEditorLayer = \_\_webpack\_exports\_\_.AnnotationEditorLayer;
 16187 │ /\*\*\*\*\*\*/ var \_\_webpack\_exports\_\_AnnotationEditorParamsType = \_\_webpack\_exports\_\_.AnnotationEditorParamsType;

Adding in case it's helpful for resolving this problem.

@the-wc
Copy link

the-wc commented Dec 7, 2023

Follow up here, @Fiattarone

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

No branches or pull requests

2 participants