prerender-loader: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

Hello !

I tried to prerender my preact application but I get this error. If I remove prerender-loader and just put the path to my index.html I donโ€™t get any error. Module build failed: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

Iโ€™m using html-webpack-plugin like so :

new htmlWebpackPlugin({
  // prerendering with prerender-loader
  template: `!!prerender-loader?string!${path.resolve(__dirname, '../src/index.html')}`,
  minify: {
    removeComments: true
  },
  cache: true,
  // make it work consistently with multiple chunks
  chunksSortMode: 'dependency'
})

Thanks for the help ! ๐Ÿ˜ƒ

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 28
  • Comments: 18

Most upvoted comments

Fixed in 1.1.0. Thanks for all the help!

Hello, I have the same issue as @cvetanov If someone could help us or write an example. That will be great ๐Ÿ˜„

Whoops - I should have caught that! It would be nice if prerender-loader took that into account and used the last entry of the Array or the main property of an object.

Or, perhaps the best solution would be to check for multi-entry configurations and respect them by using MultiEntryPlugin here: https://github.com/GoogleChromeLabs/prerender-loader/blob/5f667781679351b8f160a0e39e0deb45099d2848/src/index.js#L128

I use conditions logic for build a entry array for a different environment (debug, dev, prod), therefore using the single file impossible.

Yes, I had an object in config.entry, removed it and no problem now.