{"id":3958,"date":"2016-04-27T12:44:07","date_gmt":"2016-04-27T12:44:07","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3958"},"modified":"2016-04-27T12:44:07","modified_gmt":"2016-04-27T12:44:07","slug":"fixing-webpack-error-typeerror-request-replace-not-function","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-webpack-error-typeerror-request-replace-not-function\/","title":{"rendered":"Fixing webpack error: TypeError: request.replace is not a function"},"content":{"rendered":"<p>If you try to set up multiple entry points in Webpack, you can get the following error:<\/p>\n<pre lang=\"bash\">\nD:\\projects\\image-annotation\\node_modules\\webpack\\lib\\NormalModuleFactory.js:72\n                        var elements = request.replace(\/^-?!+\/, \"\").replace(\/!!+\/g, \"!\").split(\"!\");\n                                               ^\n\nTypeError: request.replace is not a function\n    at D:\\projects\\image-annotation\\node_modules\\webpack\\lib\\NormalModuleFactory.js:72:27\n    at D:\\projects\\image-annotation\\node_modules\\webpack\\lib\\NormalModuleFactory.js:28:4\n    at D:\\projects\\image-annotation\\node_modules\\webpack\\lib\\NormalModuleFactory.js:159:3\n    at NormalModuleFactory.applyPluginsAsyncWaterfall (D:\\projects\\image-annotation\\node_modules\\webpack\\node_modules\\tapable\\lib\\Tapable.js:75:69)\n    at NormalModuleFactory.create (D:\\projects\\image-annotation\\node_modules\\webpack\\lib\\NormalModuleFactory.js:144:8)\n    at D:\\projects\\image-annotation\\node_modules\\webpack\\lib\\Compilation.js:214:11\n    at D:\\projects\\image-annotation\\node_modules\\webpack\\node_modules\\async\\lib\\async.js:181:20\n    at Object.async.forEachOf.async.eachOf (D:\\projects\\image-annotation\\node_modules\\webpack\\node_modules\\async\\lib\\async.js:233:13)\n    at Object.async.forEach.async.each (D:\\projects\\image-annotation\\node_modules\\webpack\\node_modules\\async\\lib\\async.js:209:22)\n    at Compilation.addModuleDependencies (D:\\projects\\image-annotation\\node_modules\\webpack\\lib\\Compilation.js:185:8)\n<\/pre>\n<p>Basically, the problem is that if you create a webpack config file, it doesn&#8217;t have the ability to tell you that the JSON object is the wrong shape, because it isn&#8217;t testing this like it should.<\/p>\n<p>For instance, I got this error because I did this:<\/p>\n<pre lang=\"javascript\">\nmodule.exports = {   \n  entry: [\n    {\n      ssl_search: \".\/src\/ssl_search\/Entry.js\"\n    }\n  ]\n}\n<\/pre>\n<p>When I really should have done this:<\/p>\n<pre lang=\"javascript\">\nmodule.exports = {   \n  entry: {\n    ssl_search: \".\/src\/ssl_search\/Entry.js\"\n  }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Fixing a strange webpack error setting up multiple entry points<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[302,387,592],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3958"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=3958"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3958\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}