kuflash / react-router-sitemap

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

working with babel 7? #94

Closed cristian-sima closed 4 years ago

cristian-sima commented 5 years ago

Hi!

Is it working with babel 7, cause I am getting this:

Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "D:\\workspace\\src\\github.com\\cristian-sima\\investitii-giurgiu\\node_modules\\@babel\\preset-flow\\lib\\index.js")
    at throwVersionError (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\@babel\helper-plugin-utils\lib\index.js:65:11)
    at Object.assertVersion (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\@babel\helper-plugin-utils\lib\index.js:13:11)
    at _default (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\@babel\preset-flow\lib\index.js:33:7)
    at D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\@babel\helper-plugin-utils\lib\index.js:19:12
    at D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\node_modules\babel-core\lib\transformation\file\options\option-manager.js:317:46
    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
    at OptionManager.mergePresets (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
    at OptionManager.mergeOptions (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
    at OptionManager.init (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
    at compile (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\lib\node.js:103:45)
    at loader (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\lib\node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .jsx] (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\node_modules\babel-register\lib\node.js:154:7)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (D:\workspace\src\github.com\cristian-sima\investitii-giurgiu\create-site-map.js:11:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
kuflash commented 5 years ago

@cristian-sima it's very strange, because babel is devDependency for this is package. Are you install babel@7 in your project? Can you create test repo with this error?

inverleighdigital commented 4 years ago

I had the same issue but discovered it was due to referencing old babel library require("babel-register");

make sure you use: require('@babel/register');