electron-react-boilerplate / electron-react-boilerplate

A Foundation for Scalable Cross-Platform Apps

Home Page:https://electron-react-boilerplate.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I want to bundle Selenium but WebPack can't find it(?)

SwedFred opened this issue · comments

I built an electron app last year but because I really like working with React I migrated the project to this boilerplate. Gradually I made changes to the project only to find out that WebPack can't package it. The reason seems to be because I use Selenium by a reference in an external script that is called by my app through an instance of Mocha.

The error I get is:
ERROR in dll renderer renderer[14]
Module not found: Error: Can't resolve 'selenium' in [project path]

I don't have any experience configuring WebPack but I tried following all kind of guides that I could find and added:

          new webpack.ProvidePlugin({
            'selenium-webdriver': 'selenium-webdriver',
            'selenium': 'selenium',
            'selenium-webdriver/chrome': 'selenium-webdriver/chrome',
            'chromedriver':'chromedriver'
          }),

to the plugins section of webpack.config.renderer.prod.ts. I also tried to add dummy references to selenium in main.ts, but that didn't work either.

I'm kind of desperate to either get help to get WebPack to build with Selenium, or if there's a way to transpile a react project into vanilla JS so I don't have to re-write my project to get it to work with vanilla electron. Or if there's a way to build it with electron forge instead of WebPack.