Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use it at vite and electron?

See original GitHub issue

I use the vite program as electron renderer, but I get follow error:

SyntaxError: Cannot use import statement outside a module

I get #95 message, i need use 【require】 replace 【import】。

but in the vite, I cann’t use require. Is there any way to solve it?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

OsamaAbbascommented, Apr 12, 2021

I will look into it and see if it can be solved.

allrancommented, Apr 12, 2021

@OsamaAbbas I create a small project by CLI, the source at vite-electron-builder, and the branch name is [alan_bytecode].

You can test like this:

//1. get the code
git clone
cd vite-electron-builder
git checkout alan_bytecode
npm install 

//2. load .ts to .js
npm run precompile

//3. to bytecode
npm run bytenode

Then, the bytenode can work .js at ‘/packages/main/dist/’ and ‘/packages/preload/dist/’. But the vite code at ‘/packages/renderer/dist/’, I get some error: SyntaxError: Unexpected token ‘export’ or: SyntaxError: Cannot use import statement outside a module or other.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create an Electron application with Vite
Create the default Vite application · Install the builder · Let's edit the package.json · Let's edit the config of Vite · We...
Read more >
Building a Vue 3 Desktop App with Vite and Electron - LearnVue
To do this, we're going to be using Electron – one of the most popular frameworks for building cross-platform desktop apps with JavaScript....
Read more >
How to Set Up ELECTRON in Vite and Vue 3 - YouTube
... going to taking a look at how to build a Vue 3 desktop application from your Vite app.To do this, we're going...
Read more >
electron-vite - npm
Start using electron-vite in your project by running `npm i electron-vite`. There are no other projects in the npm registry using electron-vite.
Read more >
Building an Electron App with VueJS and Vite | Cody Bontecou
Let's combine the power of Electron with VueJS and Vite to create incredible desktop applications ... Clone this repo and use it as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found