bytenode-webpack-plugin icon indicating copy to clipboard operation
bytenode-webpack-plugin copied to clipboard

Add `webpack v5` support

Open rospirski opened this issue 4 years ago • 5 comments

Hello, I am trying to package and use webpack5, but it is returning the following error:

[webpack-cli] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
    at new NodeError (node:internal/errors:363:5)
    at validateString (node:internal/validators:119:11)
    at Object.isAbsolute (node:path:403:5)
    at isDependency (C:\ProjetosSSD\SlayderGames\Launcher\Patcher\node_modules\@herberttn\bytenode-webpack-plugin\lib\index.js:241:28)
    at C:\ProjetosSSD\SlayderGames\Launcher\Patcher\node_modules\@herberttn\bytenode-webpack-plugin\lib\index.js:210:28
    at Array.map (<anonymous>)
    at prepare (C:\ProjetosSSD\SlayderGames\Launcher\Patcher\node_modules\@herberttn\bytenode-webpack-plugin\lib\index.js:209:37)
    at C:\ProjetosSSD\SlayderGames\Launcher\Patcher\node_modules\@herberttn\bytenode-webpack-plugin\lib\index.js:154:27
    at Array.map (<anonymous>)
    at BytenodeWebpackPlugin.preprocessEntry (C:\ProjetosSSD\SlayderGames\Launcher\Patcher\node_modules\@herberttn\bytenode-webpack-plugin\lib\index.js:153:24) {
  code: 'ERR_INVALID_ARG_TYPE'
}
const { merge } = require('webpack-merge')
const BytenodeWebpackPlugin = require('@herberttn/bytenode-webpack-plugin').BytenodeWebpackPlugin
const common = require('./webpack.common.js')

module.exports = merge(common, {
    mode: 'production',
    plugins: [new BytenodeWebpackPlugin()],
})

*Just putting a note, this plugin is sensational, congratulations to the developers.

rospirski avatar May 10 '21 20:05 rospirski

Hello @rospirski! Thank you for the interest! I was really busy finishing another project, sorry for the delay.

Currently this plugin does not really support Webpack v5, we still need to adapt the code to the new hooks and test it. I haven't had time to do it, yet.

Feel free to try if your need is time sensitive! I'll happily take contributions! If not, I'll write here again when I eventually do it.

herberttn avatar May 21 '21 23:05 herberttn

Unfortunately I tried and I couldn't get it to work on the webpack, I had problems creating a virtual asset for the file loader, but without success.

I would appreciate it very much when I manage to make the webpack5 version.

rospirski avatar May 25 '21 18:05 rospirski

Hopefully this gets updated to support Webpack v5...I tried using it for our project and same error.

authrequest avatar Aug 07 '21 08:08 authrequest

There is a pull request that you can test and help improve so we can get Webpack5 support:

https://github.com/herberttn/bytenode-webpack-plugin/pull/7

jjeff avatar Aug 08 '21 03:08 jjeff

A year later, I got the same error, is there any plan to support webpack5? An unhandled exception occurred: The "path" argument must be of type string. Received an instance of Object

hanwangqyq avatar May 13 '22 02:05 hanwangqyq

@hanwangqyq it's open source. I don't think @herberttn has any current plan to work on Webpack 5 support. If you have time to contribute to https://github.com/herberttn/bytenode-webpack-plugin/pull/7. Feel free to fork my WIP branch. IIRC the critical thing that still needs doing is using the proper webpack hook to call bytenode.

dopry avatar Sep 21 '22 17:09 dopry

https://github.com/herberttn/bytenode-webpack-plugin/releases/tag/v2.0.0

herberttn avatar Oct 20 '22 05:10 herberttn