#svg logo
1 messages · Page 1 of 1 (latest)
Hi @royal wadi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The error message you’re seeing, Tags with side effect (<script> and <style>) are ignored in client component templates., typically occurs if you paste an entire SVG file—including its <script> or <style> tags—directly into a Vue/Nuxt component’s template. In Nuxt, only the SVG markup (the <svg>...</svg>) should be placed inside the template. Remove any <script> or <style> tags from the SVG before using it in your component.
How to use your SVG logo in a Nuxt component:
-
Clean the SVG:
- Open your SVG file in a text editor.
- Remove any
<script>and<style>tags. - Only keep the
<svg>...</svg>markup.
-
Remove whitespace around the SVG:
- Check the
viewBoxattribute in your SVG. If there’s extra space, you can edit the SVG in a vector editor (like Figma, Illustrator, or Inkscape) to crop the canvas tightly around your logo. - Alternatively, you can manually adjust the
viewBoxvalues to remove unwanted whitespace.
- Check the
-
Paste the cleaned SVG into your component:
<template> <!-- Paste your cleaned SVG here --> <svg ...>...</svg> </template>
Alternative: Use nuxt-svgo for auto-import and optimization
If you want to manage SVGs as components and optimize them automatically, you can use the nuxt-svgo module. Place your SVGs in a directory (e.g., ~/assets/svg/), configure autoImportPath, and use them as components without manual imports. This also helps with cleaning up unnecessary attributes and whitespace in your SVGs. See the example:
// nuxt.config.ts
svgo: { autoImportPath: '~/assets/svg/' }
Then use your SVG as a component:
<template>
<SvgoLogo class="w-7 inline" />
</template>
No need to import it manually; the module handles it for you. This approach is confirmed to work and helps keep your SVGs clean and optimized using the nuxt-svgo module, SVGs are not being loaded or "found".
Summary:
- Remove
<script>and<style>from your SVG before pasting. - Adjust the
viewBoxto remove whitespace. - For best results and easier management, consider using the nuxt-svgo module.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@royal wadi Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@rapid steppe how do i make svgo remove the whitespace in my svg? and it seems to be adding margin at the bottom?
Let me check the knowledge base for you again. One moment! :books:
I'm sorry, but the knowledge sources do not contain explicit information about configuring SVGO (or the nuxt-svgo module) to automatically remove whitespace or margins from SVGs. The available documentation confirms that nuxt-svgo can auto-import and optimize SVGs, but it does not detail specific SVGO configuration options for trimming whitespace or addressing unwanted margins at the bottom of SVGs. For advanced SVG cleanup, you may need to manually adjust the SVG's viewBox or use a vector editor before importing, as the module's default behavior is not described in detail regarding whitespace removal using the nuxt-svgo module, SVGs are not being loaded or "found".
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@royal wadi Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@rapid steppe after installing this module and trying to deploy to render i now get this error? "==> Running 'node .output/server/index.mjs'
node:internal/modules/esm/resolve:283
throw new ERR_MODULE_NOT_FOUND(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/render/project/src/.output/server/node_modules/vue/server-renderer/index.mjs' imported from /opt/render/project/src/.output/server/index.mjs
at finalizeResolution (node:internal/modules/esm/resolve:283:11)
at moduleResolve (node:internal/modules/esm/resolve:952:10)
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:574:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:236:38)
at ModuleJob._link (node:internal/modules/esm/module_job:130:49) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///opt/render/project/src/.output/server/node_modules/vue/server-renderer/index.mjs'
}
Node.js v20.19.2"
Let me check the knowledge base for you again. One moment! :books:
The error you are seeing:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/render/project/src/.output/server/node_modules/vue/server-renderer/index.mjs' imported from /opt/render/project/src/.output/server/index.mjs
indicates that the Nuxt server build is trying to import the vue/server-renderer module, but it cannot find it in the expected location inside .output/server/node_modules.
Based on the knowledge sources, this type of error often happens when:
- Some dependencies are only listed in
devDependenciesinstead ofdependencies, so they are not installed in the production environment. - The build process is not run in the production environment, or the output is copied from a different environment where dependencies differ.
- The deployment process does not include all necessary files or dependencies in the final build output.
Recommended steps (based on similar issues and solutions):
-
Move all required dependencies to
dependencies:
Make sure thatvue,@nuxt/*, and any other runtime dependencies are listed in thedependenciessection of yourpackage.json, not just indevDependencies. This ensures they are installed in production environments like Render. This step was crucial in resolving similar deployment issues on other platforms Deploy Nuxt3 to AppEngine Standard or Felxible Environment Part 2. -
Reinstall dependencies and rebuild:
- Delete
node_modulesand any lock files (package-lock.json,yarn.lock, orpnpm-lock.yaml). - Run a fresh install (
npm installoryarn install). - Rebuild your project (
nuxi buildornpm run build).
- Delete
-
Ensure the build step runs on Render:
Make sure your Render build command actually runs the Nuxt build process and does not just copy files from your local machine. The.outputdirectory and all required node modules must be present in the deployed environment. -
Check for missing modules in
.output:
If you are using custom modules or plugins, ensure they are bundled correctly and available in the.outputdirectory.
If you follow these steps and the error persists, double-check your deployment logs to ensure that all dependencies are being installed and that the build step completes successfully before the server starts.
If you need more specific guidance, please provide your package.json and the exact build and start commands used on Render.
vue] Tags with side effect (<script> and <style>) are ignored in client component templates." my svg logo also has whitespace around the edges, what's recommended to clean this up to display my logo svg nicely