kuflash / react-router-sitemap

Generate sitemap.xml by React Router configuration
MIT License
249 stars 57 forks source link

Unexpected token #83

Open nirberko opened 5 years ago

nirberko commented 5 years ago

I tried running the with the example script and I am getting this error (i also tried to update all the dependencies)

capture

kuflash commented 5 years ago

@NirBerko you installed babel in your project? node.js just doesn't understand jsx syntax

The-Code-Monkey commented 5 years ago

It is doing this for me too and i have

  "name": "brighton-site",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-register": "^6.26.0",
    "eslint": "^4.19.1",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-jsx": "^0.0.2",
    "eslint-plugin-react": "^7.9.1"
  },
  "dependencies": {
    "aos": "^2.3.4",
    "autoprefixer": "7.1.6",
    "axios": "latest",
    "b64-to-blob": "^1.2.19",
    "babel-core": "6.26.0",
    "babel-eslint": "9.0.0",
    "babel-jest": "23.6.0",
    "babel-loader": "8.0.4",
    "babel-preset-react-app": "^3.1.1",
    "babel-runtime": "6.26.0",
    "bootstrap": "^4.1.1",
    "case-sensitive-paths-webpack-plugin": "2.1.1",
    "chalk": "1.1.3",
    "connected-react-router": "^4.4.1",
    "css-loader": "0.28.7",
    "disqus-react": "^1.0.5",
    "dotenv": "4.0.0",
    "dotenv-expand": "4.2.0",
    "eslint": "5.6.0",
    "eslint-config-airbnb": "^17.0.0",
    "eslint-config-react-app": "^2.1.0",
    "eslint-loader": "1.9.0",
    "eslint-plugin-flowtype": "2.39.1",
    "eslint-plugin-import": "2.8.0",
    "eslint-plugin-jsx-a11y": "5.1.1",
    "eslint-plugin-react": "7.4.0",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "1.1.5",
    "fs-extra": "3.0.1",
    "html-webpack-plugin": "2.29.0",
    "jest": "23.6.0",
    "node-sass": "^4.10.0",
    "node-sass-chokidar": "^1.3.0",
    "object-assign": "4.1.1",
    "postcss-flexbugs-fixes": "3.2.0",
    "postcss-loader": "2.0.8",
    "promise": "8.0.1",
    "raf": "3.4.0",
    "react": "^16.2.0",
    "react-app-polyfill": "^0.2.0",
    "react-autosuggest": "^9.3.4",
    "react-avatar": "^3.2.0",
    "react-burger-menu": "^2.5.4",
    "react-custom-scrollbars": "^4.2.1",
    "react-datepicker": "^1.1.0",
    "react-dates": "^17.0.0",
    "react-dev-utils": "^5.0.1",
    "react-dom": "^16.2.0",
    "react-ga": "^2.5.6",
    "react-helmet": "^5.2.0",
    "react-redux": "^5.0.6",
    "react-router": "^4.2.0",
    "react-router-dom": "^4.2.2",
    "react-router-redux": "next",
    "react-router-sitemap": "^1.1.5",
    "react-scripts": "^2.1.1",
    "react-select": "^1.1.0",
    "react-swipeable-views": "^0.12.16",
    "react-textfit": "^1.1.0",
    "reactstrap": "^6.1.0",
    "redux": "^3.7.2",
    "redux-devtools-extension": "^2.13.2",
    "redux-form": "^7.4.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.2.0",
    "resolve": "1.6.0",
    "sanitize.css": "^5.0.0",
    "style-loader": "0.19.0",
    "sw-precache-webpack-plugin": "0.11.4",
    "url-loader": "0.6.2",
    "webpack": "4.19.1",
    "webpack-dev-server": "3.1.14",
    "webpack-manifest-plugin": "1.3.2",
    "whatwg-fetch": "2.0.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all",
    "ie 10"
  ],
  "eslintConfig": {
    "extends": "react-app"
  }
}

this as my package json and i have babel installed

kuflash commented 5 years ago

@The-Code-Monkey how you run script for build sitemap? Have you babel config file in your project? Can you show me script what building sitemap?

idavydoff commented 5 years ago

@The-Code-Monkey how you run script for build sitemap? Have you babel config file in your project? Can you show me script what building sitemap?

Can you help me with it? I've got the same error ;d

idavydoff commented 5 years ago

This is my packege.json file default

kuflash commented 5 years ago

@IDSaves can you explain how you run script for build sitemap? Maybe you need install babel preset for JSX - @babel/preset-react and package @babel/register

By the way I answered detail in it issue

I created example with CRA2 https://www.dropbox.com/s/3zw62xrfxhitfda/sitemap-builder-example.zip?dl=0

Please, download this example, run npm i and run node sitemap-builder.js. This example required node.js v8.10.0

kuflash commented 5 years ago

@IDSaves could you figure it out? Did you build a sitemap?

UihyunKim commented 5 years ago

@kuflash With your help(specifically example code), the sitemap is well generated. I should appreciate for that! Reeeeally thanks!!!

I use CRA and don't know well how to deal with babel for customize. Anyone who comes in this page, take a look at those example.zip how to set up babel things.

bbv-hungtran commented 5 years ago

@IDSaves can you explain how you run script for build sitemap? Maybe you need install babel preset for JSX - @babel/preset-react and package @babel/register

By the way I answered detail in it issue

I created example with CRA2 https://www.dropbox.com/s/3zw62xrfxhitfda/sitemap-builder-example.zip?dl=0

Please, download this example, run npm i and run node sitemap-builder.js. This example required node.js v8.10.0

Thanks a lot. This really helps!