Nuxt 3 Module custom layout style issue
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v14.18.2
- Nuxt Version:
3.0.0-rc.4-27605536.8c2c80e
- Package Manager:
yarn@1.22.19
- Builder:
vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
Please see reproduction example here: https://github.com/sppmstar/nuxt-3-module-layout-vite-bug
Describe the bug
When adding a style block to a custom layout in a Nuxt 3 module, i get the following error:
If I remove the <style> block, it works fine. See here: https://github.com/sppmstar/nuxt-3-module-layout-vite-bug/blob/master/src/layouts/custom-layout.vue#L7-L11
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Layouts directory - Nuxt
Every file (top-level) in the layouts directory will create a custom layout accessible with the layout property in the page components.
Read more >layouts/ · Nuxt Directory Structure
Nuxt provides a customizable layouts framework you can use throughout your application, ideal for extracting common UI or code patterns into reusable layout...
Read more >Introduction to Nuxt 3 modules - DEV Community
We are importing our local module here and adding some configuration values like url to make it work as expected.
Read more >How to set up and customize Tailwind in Nuxt.js - Mattermost
You'll build the front end with Nuxt.js and style it using Tailwind CSS. ... <template> <div class="flex items-center w-3/4 min-h-screen ...
Read more >Nuxt 3 + Tailwind + Eslint + i18n + Sentry Starter - Localazy
This short tutorial will help you set up a scalable Nuxt 3 ... above is enough to catch the code errors and styling...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are right, it does need a template, not a string - my mistake.
But you define layouts with
definePageMeta
, not within component options: https://stackblitz.com/edit/github-7l7hcr.This looks like an upstream issue with
@vitejs/plugin-vue
which is trying to read the virtual template from disk. You can workaround it for the moment by ensuring the template is written to disk:Or, even more simply, using your existing file: