ajv icon indicating copy to clipboard operation
ajv copied to clipboard

Change import package

Open jarqvi opened this issue 1 year ago • 9 comments

What issue does this pull request resolve? In fact, some codes that were not needed much have been removed.

What changes did you make? The recent removal of the line ‍‍‍const {default: Ajv} = require('ajv') was made possible by eliminating the export statement module.exports.default = AjvClass. As a result, we no longer require the named import of the Ajv module.

And since we mentioned the following code sample in the documentation, I don't think there is a problem: const Ajv = require("ajv")

Is there anything that requires more attention while reviewing? require packages in CJS

jarqvi avatar Jan 28 '24 19:01 jarqvi

Or at least it can be as follows: const {Ajv} = require('ajv')

The following also works: const Ajv = require('ajv')

I feel the code is cleaner with this method instead of using the code below: const {default: Ajv} = require('ajv')

jarqvi avatar Jan 29 '24 02:01 jarqvi

@jasoniangreen what happened?!

jarqvi avatar Feb 24 '24 15:02 jarqvi

@jasoniangreen what happened?!

I just wanted to pull master into your branch so I can see if it passes and do a proper review in the up to date context.

jasoniangreen avatar Feb 25 '24 19:02 jasoniangreen

Thanks.

jarqvi avatar Feb 25 '24 19:02 jarqvi

Hi @jarqvi, I don't really understand why should make this change?

jasoniangreen avatar Jun 05 '24 17:06 jasoniangreen

Hi @jasoniangreen, I felt that it has more readability when importing package.

jarqvi avatar Jun 06 '24 01:06 jarqvi

Hi @jasoniangreen, I felt that it has more readability when importing package.

Ah ok, but it would be a potentially breaking change, correct? Depending on how people are currently importing it?

jasoniangreen avatar Jun 06 '24 08:06 jasoniangreen

Hi @jasoniangreen, I felt that it has more readability when importing package.

Ah ok, but it would be a potentially breaking change, correct? Depending on how people are currently importing it?

Well, we can make these changes by keeping the previous method and be backward compatible

jarqvi avatar Jun 17 '24 11:06 jarqvi

Hi @jasoniangreen, I felt that it has more readability when importing package.

Ah ok, but it would be a potentially breaking change, correct? Depending on how people are currently importing it?

Well, we can make these changes by keeping the previous method and be backward compatible

@jasoniangreen Done.

jarqvi avatar Jul 13 '24 01:07 jarqvi