question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuxt module improvement suggestions

See original GitHub issue

Thanks, @justin-schroeder for creating a nice Nuxt module. I’ve spotted few items that could be improved regarding config loading.

Config files should be resolved from rootDir rather than srcDir. You can use resolvePath utility from @nuxt/kit to easily resolve it, respecting supported extensions. example

It would be so nice to reduce dependency on templating as much as possible. this error for instance could be directly thrown in the module instead of delegation to runtime and defaultConfig can be set as default value for configFile in module.ts.

Config could also be directly imported in module using requireModule utility and passed as options object. This not only reduces depending on templating, but also improves build time by avoid transpiler and gives more possibilities to validate config in build time or extend it with other modules.

Would be also nice to also add compatibility field in meta field to indicate only Nuxt ^3.0.0 with vue3 is supported.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:7
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
justin-schroedercommented, Feb 9, 2022

Thanks for the feedback @pi0! We’ll make these changes soon.

1reaction
justin-schroedercommented, Feb 15, 2022

@pi0 — I refactored most of the module in this most recent push — including using resolvePath and reducing the templating significantly. It now only has 2 simple template outputs. Honestly I would love to get rid of the template all together, but as far as I can tell there is no way to pass functions and other non serializable data to a nuxt plugin from a nuxt module using addPlugin (or is there?).

FormKit uses lots of user-defined functions in its configuration (like plugin functions for example) — so as far as I know, I still need to use the template to “manually” write those import statements (is my assumption true?)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve Your Developer Experience With Nuxt Components
This module comes with amazing features and options that will improve your development experience with Nuxt. No matter if you're just ...
Read more >
20 Nuxt Modules You Can Use to Build Web Apps Faster
20 Nuxt Modules (with Tips) to Increase Your Productivity and Build Web Apps Faster · 1. Nuxt Dotenv · 2. Nuxt Style Resources...
Read more >
Nuxt.js — Two super easy changes for starters that can ...
Here are two changes for Nuxt that can greatly improve your website performance. You probably knew it already if you have been playing...
Read more >
Module Improvements · Issue #10 · nuxt/rfcs
Nice idea about config overriding/preset @wagerfield. But config handling is out of module scope. The order of a nuxt project bootstrap is: 1....
Read more >
5 Nuxt Modules to Use in Your Next Project - David Parks
Until I saw this explorer, I had no idea how robust the Nuxt Module ecosystem had become. I was able to find some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found