docusaurus-theme-github-codeblock icon indicating copy to clipboard operation
docusaurus-theme-github-codeblock copied to clipboard

cannot resolve `url` with docusaurus 2.0.0-beta.18

Open YOU54F opened this issue 3 years ago • 3 comments

Hey thanks for the repo, was looking to implement this but always nice when I don't have to.

Just tried using against latest 2.0.0-beta.18 of docusaurus v2.

Fails when loading a code block with the following.

Compiled with problems:

ERROR in ./node_modules/@saucelabs/theme-github-codeblock/build/theme/ReferenceCodeBlock/index.js 26:14-28

Module not found: Error: Can't resolve 'url' in '/Users/saf/dev/pactflow/docs.pactflow.io/website/node_modules/@saucelabs/theme-github-codeblock/build/theme/ReferenceCodeBlock'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
	- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "url": false }
	```
	
Removing the import from this line in the bundled output resolves it and it works fine

https://github.com/saucelabs/docusaurus-theme-github-codeblock/blob/3e94f0555f93f97fbb4db46673905dc6b9fe1635/src/theme/ReferenceCodeBlock/index.tsx#L1

Happy to submit a pull request

YOU54F avatar Apr 03 '22 23:04 YOU54F

@discombobulateme Does this affect the docs site at all?

boneskull avatar Apr 11 '22 18:04 boneskull

@boneskull no, we are not using the package :) thank you for asking it!

discombobulateme avatar Apr 12 '22 15:04 discombobulateme

Hi, is this still WIP? I saw the PR, but no new one were made since then.

leobragaz avatar Jun 08 '22 19:06 leobragaz

closing due to maintainer inactivity

YOU54F avatar May 12 '23 03:05 YOU54F