nextui-org / nextui-cli

⌨️ A CLI tool that unlocks seamless NextUI integration.
MIT License
37 stars 14 forks source link

refactor: add imports recommended in node #45

Closed sebastiandottop closed 4 months ago

sebastiandottop commented 4 months ago

📝 Description

Hi team nextui,

In this pr I took the trosxuble to refactor the node module imports according to today's recommended imports

thanks for reading

✅ Type of change

winchesHe commented 4 months ago

@castrogarciajs Hi, could you explain what different between two import methods

sebastiandottop commented 4 months ago

Hi @winchesHe, yes of course,

Since nodejs version 16 it is no longer recommended to call native modules by name

Example (Not recommended)

import path from 'path'

It is recommended to use the node: prefix and it reduces the risk of a module present in node_modules overriding the newer imports.

It is also a more explicit protocol makes it more readable and also makes it clear that you are importing a built-in module. As there are many built-in modules, this extra information is useful for beginners or for someone who does not know some of them.

Resource where I learned what was explained: https://github.com/nodejs/node/issues/38343

Example (Recommended)

import path from 'node:path'
winchesHe commented 4 months ago

I got thx~ @castrogarciajs