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

feat(dx): warn if module is not registered but used #334

Closed
manniL opened this issue Dec 24, 2020 · 1 comment
Closed

feat(dx): warn if module is not registered but used #334

manniL opened this issue Dec 24, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@manniL
Copy link
Member

manniL commented Dec 24, 2020

🆒 Your use case

When the composition API module is added to the dependencies but not registered, an unexpected fs error appears when using the plugin in the code.

TypeError: can't access property "native", fs.realpath is undefined

(FF)

webpack-internal:///./.nuxt/client.js:215 TypeError: Cannot read property 'native' of undefined
    at eval (webpack-internal:///./node_modules/fs-extra/lib/fs/index.js:107)
    at Object../node_modules/fs-extra/lib/fs/index.js (index.js:317)
    at __webpack_require__ (runtime.js:854)
    at fn (runtime.js:151)
    at eval (webpack-internal:///./node_modules/fs-extra/lib/index.js:6)
    at Object../node_modules/fs-extra/lib/index.js (index.js:329)
    at __webpack_require__ (runtime.js:854)
    at fn (runtime.js:151)
    at Object.eval (webpack-internal:///./node_modules/@nuxtjs/composition-api/lib/index.js:6)
    at eval (webpack-internal:///./node_modules/@nuxtjs/composition-api/lib/index.js:848)
_callee$ @ webpack-internal:///./.nuxt/client.js:215

(Chrome)

🆕 The solution you'd like
Instead of showing the cryptic error, give the hint that the module has to be registered

🔍 Alternatives you've considered
If this is too much effort, keep as is (possibly this issue will be help enough then when googling?).
This is mostly a DX upgrade that might help a small number of ppl.

@manniL manniL added the enhancement New feature or request label Dec 24, 2020
danielroe added a commit that referenced this issue Feb 11, 2021
* you will no longer be able to import directly from `@nuxtjs/composition-api` outside of the nuxt context

relates to #334
Copy link
Member

Having taken a look at this, there's very little that can be done if users haven't added the module to buildModules. But I've separated out the actual utilities so they can't be imported unless it's been setup correctly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment