As I work on my simple electron app, I am facing an issue where I need to include a script using the following code:
<script src="build/script.js"></script>
In my project, I have a script.ts
file that compiles to the build
folder.
import { dialog } from 'electron'
const openFileLocationDialog = () => {
dialog.showOpenDialog({ properties: ['openFile'] })
}
const sourceButton = document.getElementById('button')
sourceButton!.addEventListener('click', openFileLocationDialog)
Despite not referencing script.ts
, when I run the application, I encounter the error:
script.ts:1 Uncaught ReferenceError: require is not defined
at script.ts:1
I'm looking for guidance on how to proceed. My primary goal is to implement a button that allows users to select a file.