Open vadimgubin opened 7 years ago
when I added require.extensions['.css','.styl'] = function () { return null; }; into sitemap-builder.js
react-transform-hmr/lib/index.js:51
throw new Error('locals[0] does not appear to be a module
object with Hot Module ' + 'replacement API enabled. You should disable react-transform-hmr in ' + 'production by using env
section in Babel configuration. See the ' + 'example in README: https://github.com/gaearon/react-transform-hmr');
^
Error: locals[0] does not appear to be a module
object with Hot Module replacement API enabled. You should disable react-transform-hmr in production by using env
section in Babel configuration. See the example in README: https://github.com/gaearon/react-transform-hmr
cross-env NODE_ENV=production node sitemap-builder.js resolve it :)
I know about this problem, but this problem is not of this library. In our projects, I also solves the problem with this code:
require.extensions['.css','.styl'] = function () {
return null;
};
Yes, but without this library I didn't have this problem. Sitemap generator for single-page React-apps is very helpful. And I hope improve your library by my bug-reports.
I am also facing this error but in different context. I tried above mentioned solution but it doesn't work for me. I do not have much experience on babel. I created below babelrc file
{ "ignore": [ "node_modules/*/" ], "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ "babel-plugin-react-css-modules", "transform-class-properties", ["module-resolver", { "cwd": "babelrc", "root": ["./src"] }] ] }
And I am getting this error:
/home/ramneet/frontend/src/base_components/Box/styles.css:1 (function (exports, require, module, filename, dirname) { .Box { ^
SyntaxError: Unexpected token .
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Object.newLoader [as .js] (/home/ramneet/frontend/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! basic@0.1.0 sitemap: node ./sitemap-builder.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the basic@0.1.0 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/.npm/_logs/2019-09-24T06_12_41_777Z-debug.log
Any help will be appreciated
@ramneet-chopra where is you added this is code?
require.extensions['.css','.styl'] = function () {
return null;
};
Can you show file where calling sitemap generator?
main.styl: Unexpected token, expected ( (1:8)
How to reproduce
"react": "^0.14.8", "react-router": "=2.0.1", "redux-router": "^2.1.2", "style-loader": "^0.13.0", "stylus": "^0.54.5", "stylus-loader": "^2.3.1", "react-router-sitemap": "^1.0.8",
const router = require('./src/router').default; const Sitemap = require('react-router-sitemap').default;
( new Sitemap(router) .build('http://my-site.ru') .save('./sitemap.xml') );