Conversation
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
Deploying cloudflare-docs with
|
| Latest commit: |
4f3b1ac
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://84975a1a.cloudflare-docs-7ou.pages.dev |
| Branch Preview URL: | https://bib-module-aliasing.cloudflare-docs-7ou.pages.dev |
threepointone
left a comment
There was a problem hiding this comment.
One small nit, but otherwise perfect. Thank you so much for this @irvinebroque!
Co-authored-by: Sunil Pai <spai@cloudflare.com>
|
|
||
| For example, some NPM packages depend on [`node-fetch`](https://www.npmjs.com/package/node-fetch), a package that provided a polyfill of the [`fetch()` API](/workers/runtime-apis/fetch/), before it was built into Node.js. | ||
|
|
||
| `node-fetch` isn't needed in Workers, because the `fetch()` API is provided by the Workers runtime. And `node-fetch` doesn't work on Workers, because it relies on currently unsupported Node.js APIs from the `http`/`https` modules. |
There was a problem hiding this comment.
Issues:
- Style Guide - (Spelling-error) Did you really mean 'APIs'?
Fix Explanation:
The term 'APIs' is correctly used in this context to refer to multiple application programming interfaces. It is a standard term in the tech industry, and there is no spelling error. If the style guide does not recognize 'APIs' as a valid plural form, it may need to be updated to reflect common industry usage. No change is needed to the text.
| export default fetch; | ||
| ``` | ||
|
|
||
| ### Example: Aliasing Node.js APIs |
There was a problem hiding this comment.
Issues:
- Style Guide - (Spelling-error) Did you really mean 'APIs'?
Fix Explanation:
The term 'APIs' is correct and widely used in technical documentation. It is not a spelling error. If the style guide suggests otherwise, it may need to be updated to reflect common industry terminology. No change is necessary to the existing text.
|
|
||
| ### Example: Aliasing Node.js APIs | ||
|
|
||
| You can use module aliasing to provide your own polyfill implementation of a Node.js API that is not yet available in the Workers runtime. |
There was a problem hiding this comment.
Issues:
- Style Guide - (Spelling-error) Did you really mean 'polyfill'?
Fix Explanation:
The term 'polyfill' is correct in this context and is a standard term in the tech industry. It is not a spelling error. If the style guide does not recognize 'polyfill,' it may need to be updated to include this term, as it is widely used in software development documentation.
|
|
||
| You can use module aliasing to provide your own polyfill implementation of a Node.js API that is not yet available in the Workers runtime. | ||
|
|
||
| For example, let’s say the NPM package you rely on calls [`fs.readFile`](https://nodejs.org/api/fs.html#fsreadfilepath-options-callback). You can alias the fs module by adding the following to your Worker’s wrangler.toml: |
There was a problem hiding this comment.
Issues:
- Style Guide - (Spelling-error) Did you really mean 'fs'?
Fix Explanation:
The term 'fs' is a standard Node.js module and is correctly used in this context. It is not a spelling error. The style guide may need to be updated to recognize 'fs' as a valid term in technical documentation related to Node.js. No change is necessary to the text.
| } | ||
| ``` | ||
|
|
||
| In many cases, this allows you to work provide just enough of an API to make a dependency work. You can learn more about Cloudflare Workers' support for Node.js APIs on the [Cloudflare Workers Node.js API documentation page](/workers/runtime-apis/nodejs/). |
There was a problem hiding this comment.
Issues:
- Style Guide - (Spelling-error) Did you really mean 'APIs'?
Fix Explanation:
The term 'APIs' is correctly used in the context of referring to multiple Application Programming Interfaces. It is a standard term in technical documentation, and there is no spelling error. No change is needed. If the style guide suggests otherwise, it may need to be updated to align with common industry usage.
Co-authored-by: Sunil Pai <spai@cloudflare.com>
* Document module aliasing * Update src/content/docs/workers/wrangler/configuration.mdx Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> * Update src/content/docs/workers/wrangler/configuration.mdx Co-authored-by: Sunil Pai <spai@cloudflare.com> * Update src/content/docs/workers/wrangler/configuration.mdx Co-authored-by: Sunil Pai <spai@cloudflare.com> --------- Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> Co-authored-by: Sunil Pai <spai@cloudflare.com>
--aliasflagcloses cloudflare/workers-sdk#6184, refs cloudflare/workers-sdk#6167, cloudflare/workers-sdk#6448
Wrangler docs need work and are too long, but for now just need this content to exist somewhere. Better structure should come in a different PR.
Open to feedback on other places in the docs that should link to this or reference it.