0
votes

I am passing html string from my backend to react component where I am using react-html-parser to convert my html string into react component. but getting error.

ERROR in ./~/entities/maps/entities.json Module parse failed: /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/entities/maps/entities.json Unexpected token (1:9) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (1:9) at Parser.pp$4.raise (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:2221:15) at Parser.pp.unexpected (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:603:10) at Parser.pp.semicolon (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:966:10) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:730:24) at Parser.pp$1.parseBlock (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:981:25) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:709:33) at Parser.pp$1.parseTopLevel (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:638:25) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:516:17) at Object.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:3098:39) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock. (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) @ ./~/react-html-parser/~/htmlparser2/lib/Tokenizer.js 4:16-54

ERROR in ./~/entities/maps/legacy.json Module parse failed: /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/entities/maps/legacy.json Unexpected token (1:9) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (1:9) at Parser.pp$4.raise (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:2221:15) at Parser.pp.unexpected (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:603:10) at Parser.pp.semicolon (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:966:10) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:730:24) at Parser.pp$1.parseBlock (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:981:25) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:709:33) at Parser.pp$1.parseTopLevel (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:638:25) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:516:17) at Object.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:3098:39) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock. (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) @ ./~/react-html-parser/~/htmlparser2/lib/Tokenizer.js 5:16-52

ERROR in ./~/entities/maps/xml.json Module parse failed: /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/entities/maps/xml.json Unexpected token (1:6) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (1:6) at Parser.pp$4.raise (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:2221:15) at Parser.pp.unexpected (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:603:10) at Parser.pp.semicolon (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:966:10) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:730:24) at Parser.pp$1.parseBlock (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:981:25) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:709:33) at Parser.pp$1.parseTopLevel (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:638:25) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:516:17) at Object.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:3098:39) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock. (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) @ ./~/react-html-parser/~/htmlparser2/lib/Tokenizer.js 6:16-49

ERROR in ./~/entities/maps/decode.json Module parse failed: /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/entities/maps/decode.json Unexpected token (1:4) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (1:4) at Parser.pp$4.raise (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:2221:15) at Parser.pp.unexpected (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:603:10) at Parser.pp.semicolon (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:966:10) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:730:24) at Parser.pp$1.parseBlock (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:981:25) at Parser.pp$1.parseStatement (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:709:33) at Parser.pp$1.parseTopLevel (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:638:25) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:516:17) at Object.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/acorn/dist/acorn.js:3098:39) at Parser.parse (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock. (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /Users/PrashantKumarKatariya/teabox_web/teabox_django/static/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) @ ./~/entities/lib/decode_codepoint.js 1:16-46

1

1 Answers

0
votes

Try adding a Json loader. had the same error and this worked for me. https://github.com/webpack-contrib/json-loader