Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use electron directly, got "Cannot find module 'node:assert/strict'" #38

Open
forever-z-133 opened this issue May 13, 2024 · 1 comment

Comments

@forever-z-133
Copy link

I use this plugin first, webpack.config.js is just like your example, but I don't use electron-forge.

// src/main.js
const { app, BrowserWindow } = require('electron');
/** createWindow and so on **/
// webpack.electron.config.js
module.exports = {
  entry: {
    main: join(__dirname, 'src/main.js'),
  },
  output: {
    filename: '[name].js',
    devtoolModuleFilenameTemplate: '[absolute-resource-path]',
    // libraryTarget: 'commonjs2',
  },
  resolve: {
    extensions: ['.js', '.json'],
  },
  plugins: [
    new BytenodeWebpackPlugin({
      compileAsModule: true,
      compileForElectron: true,
    }),
  ],
  mode: 'production',
  target: 'electron-main',
}
// shell
webpack ./webpack.electron.config.js
/** got Error: Cannot find module 'node:assert/strict' **/

even if I use bytenode directly, there are similar errors.

here is my reproducible code: https://github.com/forever-z-133/bytenode-electron-error-example

please help me, if you have time, Thank you very much.

@zhixinUser01
Copy link

maybe downgrade bytenode version can resolve you question. electron:14.x.x internal node version is under 15,but bytenode 1.5.6 use "node:assert/strict", node 14.x.x not surport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants