herberttn / bytenode-webpack-plugin

Compile JavaScript into bytecode using bytenode
MIT License
105 stars 27 forks source link

NodeJS 12 Support ? #16

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello !

I am looking to use your webpack plugin, but unfortunately I get errors when I load the module on my webpack config JS file. For technical reasons, I can't go further Electron 11 so NodeJS 12 is the last version I can use. I am also forced to stay on Webpack 4.

I tried to use version 1.2.5, without success : it seems like it also require NodeJS 14.

Is there anything I can do to use it ? Upgrading my Electron stack is really not an option.

ghost commented 1 year ago

The error I get : SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:1053:16) at Module._compile (internal/modules/cjs/loader.js:1101:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Module.require (internal/modules/cjs/loader.js:1025:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (webpack.config.js:6:31) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Module.require (internal/modules/cjs/loader.js:1025:19) at require (internal/modules/cjs/helpers.js:72:18) at WebpackCLI.tryRequireThenImport (node_modules\webpack-cli\lib\webpack-cli.js:204:22) at loadConfigByPath (node_modules\webpack-cli\lib\webpack-cli.js:1404:38)

Thank you very much for any help

ghost commented 1 year ago

I figured out to troubleshot myself by installing NodeJS 14 + webpack 5. It still manages to compile with Electron 11, and I can target node12 bytenode with the electron parameter of your webpack tool :)

herberttn commented 1 year ago

Yes, node v14 is required to run this plugin, but you can target your webpack build to different versions. The code you run to build your project is not the same as the code you generate.

I'd recommend trying to upgrade soon, the more you fall behind the harder it is to upgrade when you eventually do. Node v14 is already reaching end of life, and node v12 doesn't even get maintenance anymore.