-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Fail to transpile other js files next to src/main/index.js file #433
Comments
That's probably because the electron-webpack doesnt transpile preload file.
I added something transpile it, i dont remember it right now. You should
try writing plain script.
…On Sat, Mar 6, 2021, 7:14 AM Ravi Shrestha ***@***.***> wrote:
- *Version*: 22.9.1
- *Target*: Windows, Mac
Failed to transpile other js files like preload.js which are also sitting
inside src/main folder. Throws an error: Cannot use import statement
outside a module
[image: Screen Shot 2021-03-06 at 5 49 58 PM]
<https://user-images.githubusercontent.com/13145522/110206195-6dfd8680-7ea4-11eb-87ac-bf60851fde6b.png>
The main src/main/index.js seems fine for transpilation but rest of other
files have an issue transpiling it.
Do we need to handle this from a custom webpack file i.e.
custom.webpack.additions.js. Or am i missing something?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#433>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIICLM6VUXC5M25DNGVILCDTCIMEDANCNFSM4YWVQAOQ>
.
|
@shahkeyur I tried to deal this with adding a custom webpack script in a
and tried to do
then doing |
The preload script is expected to be a static Javascript file, not a module. This is by electron, not electron-webpack. You'll be having a hard time teaching electron-webpack how to generate such static script based on complex module, like you're trying. The way I see it, there are at least three ways for you here:
|
Personally, I'd take a step back and look at the situation trying 3). It's mostly the right thing to do when there's a next problem whenever you worked around the last one. If that doesn't work, I'd go 2) - it should be straightforward, however you'll need basic knowledge of webpack and electron-webpack. Option 3) would be best for everyone including yourself, but it would require you to spend significant time and put some creative engineering skills on the table. |
Failed to transpile other js files like
preload.js
which are also sitting insidesrc/main
folder. Throws an error:Cannot use import statement outside a module
The main
src/main/index.js
seems fine for transpilation but rest of other files have an issue transpiling it.Do we need to handle this from a custom webpack file i.e.
custom.webpack.additions.js
. Or am i missing something?The text was updated successfully, but these errors were encountered: