Skip to content
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

Question about "return config?. registry" . #1

Open
mdxiaohu opened this issue Nov 7, 2023 · 3 comments
Open

Question about "return config?. registry" . #1

mdxiaohu opened this issue Nov 7, 2023 · 3 comments

Comments

@mdxiaohu
Copy link

mdxiaohu commented Nov 7, 2023

./node_modules/@basd/registry/lib/registry.js 125:18
Module parse failed: Unexpected token (125:18)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. 
See https://webpack.js.org/concepts#loaders

After downloading the plugin normally, an error will be reported .

 static get(config) {
    if (config instanceof this) return config
    return config?.registry instanceof this ? config.registry : new this(config)
  }

The reason lies in the use of '?.'

Maybe it could be changed to something like this

return config && config.registry instanceof this ? config.registry : new this(config);

Or there could be a better way .

@mdxiaohu
Copy link
Author

mdxiaohu commented Nov 7, 2023

I have another question to ask .

const { _, log } = require('@basd/base')

Can the '_' here be replaced with the original version of 'lodash' .

I don't know if '@ basd/base' has magic modified the method of '_' .

@basedwon
Copy link
Owner

basedwon commented Nov 7, 2023

So, I updated the get method to use lodash get instead, let me know if that works. And regarding the basd lib, if you're using that then you can call it whatever you want other than _, I don't have a way to access the original lodash, I tried to not overwrite any existing methods though.

@mdxiaohu
Copy link
Author

mdxiaohu commented Nov 7, 2023

Using '_.get' is completely acceptable.
Thank you for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants