Package python script in electron app using webpack

Viewed 39

I have an existing typescript based electron application which uses webpack. Now, I need do add some python scripts in order to achieve some task and would want to bundle the python script with executable. I tried using various approach using no-py and adding below rule in webpack

const pyLoaderConfig = {
  test: /\.py$/,
  loader: 'py-loader',
  options: {
    compiler: 'pj'
  }
}

and

const pythonConfig = createWebPackConfig({
  target: 'electron-renderer',
  entry: path.join(__dirname, 'src', 'share-blocker', 'mac_script.py'),
  output: {
    filename: 'mac-script.js',
    path: path.join(__dirname, 'dist')
  },
  plugins: [new webpack.DefinePlugin(globalConstants), new WebpackObfuscator(obfuscatorOptions)]
});

When i execute the build, It says Module not found: Error: Can't resolve 'Quartz' in '/project/packages/test/src/share-blocker'.

0 Answers
Related