-
Notifications
You must be signed in to change notification settings - Fork 0
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
Content about nodejs loader #349
Conversation
@JakobJingleheimer could you review this content. Second part, I mean second post will be how to use nodejs-loaders . |
|
||
#### The `resolve` Hook | ||
|
||
The `resolve` hook is responsible for determining the location of a module given a specifier. A specifier is the string or URL that you pass to `import` or `require`. For example, when you write `import 'some-module'`, the `resolve` hook helps Node.js figure out where `some-module` is located. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `resolve` hook is responsible for determining the location of a module given a specifier. A specifier is the string or URL that you pass to `import` or `require`. For example, when you write `import 'some-module'`, the `resolve` hook helps Node.js figure out where `some-module` is located. | |
The `resolve` hook is responsible for determining the location of a module, given a specifier. A specifier is the string or URL that you pass to `import` or `require`. For example, when you write `import 'some-module'`, the `resolve` hook helps Node.js figure out where `some-module` is located. |
technically, the thing you pass to require()
is called an identifier (or "id").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Humm yes but most of user will use and understand it as a "module" so I will take this as it
|
||
Loaders can be used to implement import maps, which allow you to define custom mappings for module specifiers. This can be useful for overriding the default behavior of `import` statements and `require` calls, making it easier to manage dependencies and module versions. | ||
|
||
#### 6. Enabling Hot Module Replacement (HMR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe HMR should be a loader we add to @nodejs/loaders 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iDK I saw that on nodejs/loaders
repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm?
Co-authored-by: Jacob Smith <[email protected]>
Co-authored-by: Jacob Smith <[email protected]>
@JakobJingleheimer wanna be added as author ? |
🥰 thank you, but you wrote 99.99% of this. I don't wanna steal your thunder. |
@@ -15,7 +15,9 @@ const Codebox: FC<CodeboxProps> = async props => { | |||
if (!isValidElement(props.children)) return null; | |||
|
|||
const code = props.children.props.children.trim(); | |||
const lang = props.children.props.className.replace('language-', '').replace('mjs', 'js'); | |||
const lang = props.children.props.className |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it seems wrong to use classname (but if that's how some tool works, sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have test it manually 😇
"I am the test runner"
Co-authored-by: Jacob Smith <[email protected]>
Co-authored-by: Jacob Smith <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
Big thanks Jacob for your review |
You're welcome! |
No description provided.