Coder Social home page Coder Social logo

cheap-glitch / vue-cli-plugin-sitemap Goto Github PK

View Code? Open in Web Editor NEW
41.0 2.0 10.0 731 KB

πŸ—ΊοΈ A Vue CLI plugin to generate simple or complex sitemaps effortlessly.

Home Page: https://npm.im/vue-cli-plugin-sitemap

License: ISC License

JavaScript 100.00%
vue vue-cli vue-cli-3 vue-cli-plugin sitemap sitemap-xml sitemap-generator vue-router

vue-cli-plugin-sitemap's Introduction

banner

vue-cli-plugin-sitemap

license badge latest release badge codecov badge

vue-cli-plugin-sitemap generates sitemaps for your Vue web apps. You can use it on its own or integrate it in the definition of the routes used in Vue Router. Features:

  • πŸ›£οΈ generate sitemaps from an array of routes
  • πŸ”€ support dynamic routes with single or multiple parameters
  • 🍱 support nested routes
  • 🚧 automatically escape the URLs and enforce a (non-)trailing slash policy
  • βœ‚οΈ automatically split the large sitemaps (more than 50,000 URLs) and generate the associated sitemap index
  • ✨ optionally prettify the output

Table of contents

Installation

vue add sitemap

The plugin will add a script called sitemap to your package.json. No other files will be modified.

Setup

Usage with vue-router

The recommended way to provide data to the plugin is to pass it the array of routes used by Vue Router. To do this, you'll need to separate the declaration of the routes and the instantiation of the Vue Router into two different modules.

Below is a simplified example of this setup, using esm to load ES6 modules into vue.config.js (this is needed until #4477 is implemented). Note that this comes with a few restrictions in src/routes.js:

  • you can import other JS modules, but no .vue files because esm won't know how to load them (you'll have to rely on dynamic imports using Node's require() for the component property)
  • you can't use the @ placeholder in the inclusion paths, as this is a bit of sugar syntax defined by vue-loader to shorten paths when loading files with webpack
// vue.config.js

require = require('esm')(module);
const { routes } = require('./src/routes.js');

module.exports = {
	pluginOptions: {
		sitemap: {
			baseURL: 'https://example.com',
			routes,
		}
	}
}
// src/routes.js

export const routes = [
	{
		path: '/',
		name: 'home',
		component: () => import(/* webpackChunkName: "home" */ './views/Home.vue')
	},
	{
		path: '/about',
		name: 'about',
		component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
	},
]
// src/main.js

import Vue        from 'vue'
import Router     from 'vue-router'
import App        from './App.vue'
import { routes } from './routes.js'

Vue.use(Router);
const router = new Router({
	mode: 'history',
	base: process.env.BASE_URL,
	routes,
});

new Vue({ router, render: h => h(App) }).$mount('#app');

Usage as a standalone plugin

You can also directly provide some handwritten URLs to the plugin:

// vue.config.js

module.exports = {
	pluginOptions: {
		sitemap: {
			urls: [
				'https://example.com/',
				'https://example.com/about',
			]
		}
	}
}

If both routes and URLs are provided, they will be merged together in a single sitemap. In the case of duplicated locations, handwritten URLs will prevail over their matching routes.

CLI

To examine the output without triggering the whole build process, run the following command to generate a sitemap in the current working directory:

npm run sitemap

CLI options

When running the plugin on the command line, it will follow the options set in vue.config.js. If needed, you can overwrite those with some CLI options:

  • -p, --pretty: produce a human-readable output
  • -o <dir>, --output-dir <dir>: specify a directory in which the sitemap will be written

Note: when calling the CLI through npm scripts, don't forget to add -- before specifying the options to ensure that npm won't capture them, e.g. npm run sitemap -- --pretty -o dist/.

Options

Global options

All the global options are optional and can be omitted, except for baseURL that must be provided for route-based sitemaps.

sitemap: {
	// Only generate during production builds (default: `false`)
	productionOnly: true,

	// Define the output directory (default: global `outputDir`)
	//
	// Note: the official specification strongly recommends placing
	//       the sitemap at the root of the website
	outputDir: '/temp/sitemap',

	// If set to `true`, add a trailing slash at the end of every URL
	// If set to `false`, always remove it (default: `false`)
	trailingSlash: false,

	// Set to `true` to produce URLs compatible with hash mode
	// (default: `false`)
	hashMode: false,

	// Insert line breaks and tabulations to make the generated
	// file more readable (default: `false`)
	pretty: true,

	// Define an URL which will serve as a prefix for every URL
	// in the sitemap
	// If it is provided, all URLs must be partial and not start with the
	// domain name (e.g. '/page/subpage')
	//
	// Note: this is required if some routes are provided, because
	//       every URL in the sitemap must be a full URL that includes
	//       the protocol and domain
	baseURL: 'https://example.com',

	// Default meta tags for every URL
	// These will be overridden by URL-specific tags
	defaults: {
		lastmod:    '2020-01-01',
		changefreq: 'weekly',
		priority:   1.0,
	},
}

URL meta tags

In the sitemap format, each URL can be associated with some optional meta tags to help the crawlers update the pages and prioritize the critical URLs:

Meta tag Accepted values for the equivalent property Default value if absent
lastmod a date string in the W3C format, a JavaScript timestamp string, a numeric timestamp or a Date object Ø
changefreq "always", "hourly", "daily", "weekly", "monthly", "yearly", "never" Ø
priority a multiple of 0.1 between 0.0 and 1.0 0.5

For more information on those meta tags, you can consult the official specification.

Example with a route object:

{
	path: '/about'
	component: () => import(/* webpackChunkName: "about" */ './About')

	meta: {
		sitemap: {
			lastmod:    'December 22, 2019',
			priority:    0.8,
			changefreq: 'daily',
		}
	}
}

Example with a handwritten URL:

sitemap: {
	urls: [
		{
			loc:        'https://example.com/about',
			lastmod:    'December 22, 2019',
			priority:    0.8,
			changefreq: 'daily',
		},
	]
}

Dynamic routes

If you use dynamic routes (e.g. /user/:id), you must provide some slugs to generate the corresponding URLs (or set the ignoreRoute option to true):

// src/routes.js

module.exports = [
	{
		path: '/articles/:title',
		meta: {
			sitemap: {
				slugs: [
					'my-amazing-article',
					'a-life-changing-method-for-folding-socks',

					// Slugs can have their own meta tags
					{
						title:     'a-very-important-article',
						priority:  1.0,
					}
				],
			}
		}
	},
	{
		// Optional and regex-validated parameters are supported
		path: '/blog/:category/:id(\\d+)/:title?',
		meta: {
			sitemap: {
				// For dynamic routes with multiple parameters, each slug
				// must be an object with a key for each parameter
				slugs: [
					{
						id:        1,
						title:     'hello-world',
						category:  'infos',
					},
					{
						id:        2,
						title:     'how-to-fold-socks-faster',
						category:  'lifehacks',

						priority:  0.9,
						lastmod:   'February 02, 2020 09:24',
					},
					{
						// Slugs that don't match the regex pattern
						// of their parameter will throw an error
						id:        'invalid-slug',
						title:     'another-post',
						category:  'misc',
					}
				]
			}
		}
	},
	{
		path: '/user/:id',
		meta: {
			sitemap: {
				// Slugs can also be provided asynchronously
				// The callback must always return an array
				slugs: async () => await getActiveUsers(),
			}
		}
	},
]

Nested routes

Nested routes are supported:

// src/routes.js

module.exports = [
	{
		path: '/user/:id',
		meta: {
			sitemap: {
				// The meta properties of parents
				// will be inherited by their children
				changefreq: 'monthly',
				priority:   0.7,

				slugs: getUserList(),
			}
		},

		children: [
			{
				path: 'profile',
				meta: {
					sitemap: {
						// The meta properties of children
						// override those of their parents
						changefreq: 'weekly',
					}
				}
			},
		]
	},
]

This example will produce the following sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<url>
		<loc>https://example.com/user/1/profile</loc>
		<priority>0.7</priority>
		<changefreq>weekly</changefreq>
	</url>
	<url>
		<loc>https://example.com/user/2/profile</loc>
		<priority>0.7</priority>
		<changefreq>weekly</changefreq>
	</url>
	<!-- [...] -->
</urlset>

Other route-specific options

// src/routes.js

module.exports = [
	{
		path: '/admin/secure-page',

		// Explicitly ignore this route and all its children
		meta: { sitemap: { ignoreRoute: true } }
	},
	{
		// Routes with a glob in their path will be ignored...
		path: '*',
		name: '404',
	},
	{
		path: '/glob/*',

		// ...unless you provide a handwritten path to replace it
		meta: { sitemap: { loc: '/glob/lorem/ipsum' } }
	},
]

Changelog

You can consult the full changelog here.

License

This software is distributed under the ISC license.

vue-cli-plugin-sitemap's People

Contributors

cheap-glitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vue-cli-plugin-sitemap's Issues

Doesn't support nested routes

For example:

[{
  path: '/user/:id', component: User,
  children: [
    {
      // when /user/:id/profile is matched
      path: 'profile', component: UserProfile
    },
    {
      // when /user/:id/posts is matched
      path: 'posts', component: UserPosts
    }
  ]
}]

How can I use ES6 in vue.config.js?

import routes from "./src/router/routes";
       ^^^^^^

SyntaxError: Unexpected identifier

also require does not work as routes are dependent on store

const routes = require("./src/router/routes");

import store from "@/store";
       ^^^^^

SyntaxError: Unexpected identifier

and on and on ...

Use without Vue CLI

Hi!

I'm a big fan of quasar, it's have his own cli and would be cool to allow use this plugins without the Vue CLI requisite, so anyone can use it.

Thanks in advance πŸ˜„

require.context is not a function for dynamic slugs

I am trying to fetch all the filenames that I have inside a /posts folder let's say. In there I have quite a few markdown files. The files are blog-posts that live in a route with props just like blog-posts/:title. I'm trying to dynamically generate the slugs for that route sitemap using require.context from webpack. With npm run serve that approach works just fine when I log values to the console. But trying to npm run build I end up with require.context is not a function. I'm suspecting that his happens because the require.context is happening before webpack is set. So how could I dynamically load all the post filenames from a folder and pass them as slugs to a route?

null pointer during dynamic route without children

I think theres a problem with the way the generateURLsFromRoutes function handles children. In the case of dynamic routes, its acceptable not to have children routes defined and this function checks for children in route. However, the validation setup in the plugin startup process assigns children to undefined if they are not defined at all.

So eventually the generateURLsFromRoute function tries to recurse for child routes and you get a undefined while reading .map

async function generateURLsFromRoutes(routes, parentPath = '', parentMeta = {}) {
  const urls = await Promise.all(routes.map(async function(route) {
  // Avoid "contaminating" children route with parent 'loc' property
  delete parentMeta.loc;
  ......

  /**
  * Static route
  */
  // this causes the undefined reference from the above Promise.all(routes.map)
  if (!params.length) return ('children' in route) ? await generateURLsFromRoutes(route.children, path,     meta) : { loc: path, ...meta };

Here is the raw route definition:

{
   "path": "/policies/:type(terms\\-of\\-service|privacy\\-policy)",
   "name": "policyView",
   "components": { "default": "PolicyView", "NavBar": "NavBar" },
   "meta": {
     "sitemap": {
       "slugs": [
         {
           "type": "privacy-policy",
           "priority": 1.0
         },
         {
           "type": "terms-of-service",,
           "priority": 1.0
         }
       ]
     }
   }
}

The rational here is, all I want to do is swap some component logic in the same parent route:
/policies/privacy-policy -> matches policyView -> renders cached PolicyView component; async loaded & webpack chunked
/policies/terms-of-service -> matches policyView -> renders cached PolicyView component; async loaded & webpack chunked

The component simply swaps the vuex reference for the text content based on the matched route param: { type: 'privacy-policy or terms-of-service' } value.

Here is the stack trace:

ERROR  TypeError: Cannot read properties of undefined (reading 'map')
TypeError: Cannot read properties of undefined (reading 'map')
    at generateURLsFromRoutes (/home/ezwebproductions/workspaces/web/sites/ezwebproductions/node_modules/vue-cli-plugin-sitemap/src/sitemap.js:99:40)
    at /home/ezwebproductions/workspaces/web/sites/ezwebproductions/node_modules/vue-cli-plugin-sitemap/src/sitemap.js:121:60
    at Array.map (<anonymous>)
    at generateURLsFromRoutes (/home/ezwebproductions/workspaces/web/sites/ezwebproductions/node_modules/vue-cli-plugin-sitemap/src/sitemap.js:99:40)
    at generateSitemaps (/home/ezwebproductions/workspaces/web/sites/ezwebproductions/node_modules/vue-cli-plugin-sitemap/src/sitemap.js:14:100)
    at writeSitemap (/home/ezwebproductions/workspaces/web/sites/ezwebproductions/node_modules/vue-cli-plugin-sitemap/index.js:84:25)
    at build.fn (/home/ezwebproductions/workspaces/web/sites/ezwebproductions/node_modules/vue-cli-plugin-sitemap/index.js:74:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

After setting the null checks in the 3 locations I saw within the generateURLsFromRoute the sitemap generated successfully.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://ezwebproductions.com</loc>
    <lastmod>2023-05-27T00:20:18.419Z</lastmod>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://ezwebproductions.com/policies/privacy-policy</loc>
    <lastmod>2023-05-27T00:20:18.419Z</lastmod>
    <priority>0.9</priority>
  </url>
  <url>
    <loc>https://ezwebproductions.com/policies/terms-of-service</loc>
    <lastmod>2023-05-27T00:20:18.419Z</lastmod>
    <priority>0.8</priority>
  </url>
</urlset>

outputDir option?

There is not outputDir option to set output location to diff folder? Upon attempt, i get [vue-cli-plugin-sitemap]: options should NOT have additional properties

Issue working with chain webpack

Have an issue getting this to work well with chain webpack and vue-cli. I have tried multiple approaches to get it working however the constructor arguments make me wonder if its compatible.

const SiteMap = require('vue-cli-plugin-sitemap')
const requireESM = require('esm')(module)
const routes = requireESM('./src/routes')
const pluginAPI = require('@vue/cli-service').PluginAPI
...

config
.plugin('vue-cli-plugin-sitemap')
.use(SiteMap, [{
  url: 'https://example.com,
  routes
}])
> vue-cli-service serve

 INFO  Starting development server...
 ERROR  TypeError: Plugin is not a constructor
TypeError: Plugin is not a constructor

Then using init, I dont know where I would accessthe PluginAPI constructor parameter for the vue cli server or why I would have to:

config
.plugin('vue-cli-plugin-sitemap')
.init((init, args) => {
   api = new pluginAPI('any-id', ???)
   return init(api, args[0])
 })
.use(SiteMap)
.tap((options) => {
  options[0] = {
     sitemap: { 
      url, 
      routes: routes.rawRoutes 
     }
   }
  return options
])

Async slugs don't work.

// Slugs can also be provided via an asynchronous function
slugs: async () => [...await someAsyncCallToADatabase()]

This doesn't work because of validation:

const slugsSchema = {
	type:  'array',
        ...

Usage with Vite

Is it possible to use with a Vite-Vue app? any documentation available yet?

Use with /* webpackChunkName: "-----" */

Does this work with eg. component: /* webpackChunkName: "blahblah" */ for dynamically loaded component routes? Likely not and a workaround would be needed for that i guess.

TypeError: Cannot read property 'sitemap' of undefined

Hello! Running npm run serve produces this error. Full log:

TypeError: Cannot read property 'sitemap' of undefined
    at /home/samuelc/MEGA/webdev/samuel-cho-v3/node_modules/vue-cli-plugin-sitemap/index.js:45:50
    at Service.run (/home/samuelc/MEGA/webdev/samuel-cho-v3/node_modules/@vue/cli-service/lib/Service.js:230:12)
    at Object.<anonymous> (/home/samuelc/MEGA/webdev/samuel-cho-v3/node_modules/@vue/cli-service/bin/vue-cli-service.js:36:9)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] sitemap: `vue-cli-service sitemap`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] sitemap script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/samuelc/.npm/_logs/2020-03-12T20_28_22_841Z-debug.log

Here are the contents of the debug log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'sitemap' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'presitemap', 'sitemap', 'postsitemap' ]
5 info lifecycle [email protected]~presitemap: [email protected]
6 info lifecycle [email protected]~sitemap: [email protected]
7 verbose lifecycle [email protected]~sitemap: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~sitemap: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/samuelc/MEGA/webdev/samuel-cho-v3/node_modules/.bin:/home/samuelc/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
9 verbose lifecycle [email protected]~sitemap: CWD: /home/samuelc/MEGA/webdev/samuel-cho-v3
10 silly lifecycle [email protected]~sitemap: Args: [ '-c', 'vue-cli-service sitemap' ]
11 silly lifecycle [email protected]~sitemap: Returned: code: 1  signal: null
12 info lifecycle [email protected]~sitemap: Failed to exec sitemap script
13 verbose stack Error: [email protected] sitemap: `vue-cli-service sitemap`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:321:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:321:20)
13 verbose stack     at maybeClose (internal/child_process.js:1026:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/samuelc/MEGA/webdev/samuel-cho-v3
16 verbose Linux 5.4.22-1-MANJARO
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "sitemap"
18 verbose node v13.9.0
19 verbose npm  v6.13.7
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] sitemap: `vue-cli-service sitemap`
22 error Exit status 1
23 error Failed at the [email protected] sitemap script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Any help would be appreciated. Thanks!

Installing plugin runs eslint --fix unexpectedly

After installing the plugin, when the generator is invoked, it seems to be running eslint --fix on my code, despite the fact that:

a) I did not ask it to
b) I have lintOnSave: false in vue.config.js

I can't find any reference to this in the source, though, apart from the presence of a .eslintrc (and it does appear to be using my settings, and not the project's).

Is this something that the plugin is doing, or is it Vue (version 2.6.11) itself being odd?

(Also, was that the last step in the generator process? Has something been left incomplete by that eslint error?)

└─▷ vue add sitemap

πŸ“¦  Installing vue-cli-plugin-sitemap...

yarn add v1.22.10
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
success Saved 5 new dependencies.
info Direct dependencies
└─ [email protected]
info All dependencies
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
└─ [email protected]
✨  Done in 83.00s.
βœ”  Successfully installed plugin: vue-cli-plugin-sitemap


πŸš€  Invoking generator for vue-cli-plugin-sitemap...
β ‹  Running completion hooks...error: 'itDoesNotAllowAnyFeedsToBeSynced' is assigned a value but never used (no-unused-vars) at tests/e2e/integration/calendar_feeds_spec.js:224:7:
  222 | }
  223 |
> 224 | const itDoesNotAllowAnyFeedsToBeSynced = () => {
      |       ^
  225 |   cy.get('.calendar-feeds table tbody tr button')
  226 |     .contains('Sync')
  227 |     .should('not.exist')


1 error found.

Support for 'hash' router mode

Hi there,

This is a great project. Thank you.

I have a project which has to use the 'hash' router mode, but the hash (#) symbol isn't automatically added to the URLs in the generated sitemap.

If I add the # symbol to the baseURL option, I get errors about it not matching the expected pattern. Am I doing something wrong?

If not, would it be possible to add support for the 'hash' router mode and allow the # symbol to be used in the baseURL please?

Thanks.

Doesn't support typescript

When the routes array is in a typescript module (routes.ts) with typescript specific syntax, then we can't import it into vue.config.js.

When I write:

require = require('esm')(module)
const routes = require('./src/router/routes/index.ts')

I get the error:

 SyntaxError: Invalid or unexpected token
.../src/router/routes/index.ts:11
export default <RouteConfig[]>[
                         ^

Cannot use import statement outside a module

Not working at all for me.

Did everything that is written in your doc but I do get this error

ERROR Error loading vue.config.js:
ERROR SyntaxError: Cannot use import statement outside a module
/src/router/index.js:1
import Vue from "vue";
^^^^^^

'npm add sitemap' does work

installed the vue-cli-plugin-sitemap, but it didn't generate the script in the package.json after carrying out 'npm add sitemap'
environment: vue2

Is typescript support on the horizon with this plugin?

As the title says really.. I have a vue app in typescript but adding this plugin fails as it cannot parse ts.

Adding ts-node at the top half works but then it cannot resolve the .vue files properly :/

require('ts-node').register();
const routes = require('./src/router/routes.ts');

How use with --modern flag?

If I build the application with the --modern flag, then the error appears:

out:  ERROR  Error: Command failed: node /usr/src/app/node_modules/@vue/cli-service/bin/vue-cli-service.js build --modern --silent
out: Error: Command failed: node /usr/src/app/node_modules/@vue/cli-service/bin/vue-cli-service.js build --modern --silent
out:     at makeError (/usr/src/app/node_modules/execa/index.js:174:9)
out:     at /usr/src/app/node_modules/execa/index.js:278:16
out:     at processTicksAndRejections (internal/process/task_queues.js:93:5)
out:     at async /usr/src/app/node_modules/@vue/cli-service/lib/commands/build/index.js:66:9
out:     at async build.fn (/usr/src/app/node_modules/vue-cli-plugin-sitemap/index.js:69:4)

Override created sitemap

Docs mention to run npm run sitemap to inspect the output and this follows the config, but when the sitemap already exists is there a way to override it programmatically ? When I run the same command it doesn't seem to change the output rather ignores it.
My use case is that I need to generate/update this sitemap daily and need to override it.

Invalid or unexpected token

/Users/mysuer/Desktop/project/src/views/Home.vue:1
<template>
^

I get this error after running npm run sitemap, I am confused as the build npm run build runs successfully
Can someone help with this please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.