Skip to content
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

Custom preload script does not seem to be packaged #155

Closed
Gerolmed opened this issue Apr 19, 2022 · 6 comments
Closed

Custom preload script does not seem to be packaged #155

Gerolmed opened this issue Apr 19, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Gerolmed
Copy link

Describe the bug
I have to preload scripts preload.ts and preload.game.ts. I adjusted the webpack config so it would properly build the second one:
image
But while everything works fine when I serve it out of the IDE, once I package it and try using that it wont find the preload.game.js but only the normal preload.js. I checked the app.asar file and also found it to be missing.

To Reproduce
Steps to reproduce the behavior:

  1. nx run standalone-launcher:package
  2. the app.asar only contains preload.js and not preload.game.js

Additional Information
webpack config in standalone-launcher folder:

module.exports = (config) => {
    config.entry = {
        ...config.entry,
        "preload.game": ['apps/standalone-launcher/src/app/api/preload.game.ts'],
    };
    return config;
};

Screenshots
image

Desktop (please complete the following information):

  • Nx electron version 12.1.0
  • Nx version 12.10.1
@bennymeg
Copy link
Owner

this feature did not got merged at this build.
You should specify to include this file manually at the maker options config file.
I'll try to include it in the next release.

@bennymeg bennymeg self-assigned this Apr 20, 2022
@bennymeg bennymeg added the enhancement New feature or request label Apr 20, 2022
@bennymeg bennymeg added this to the v13 milestone Apr 20, 2022
@Gerolmed
Copy link
Author

How do I specify it in the config?

@bennymeg
Copy link
Owner

#139 (comment)

@Gerolmed
Copy link
Author

Im not quite sure what the "root" is inside the nx project.
Ive tried this:

"files": [{
        "from": "apps/standalone-launcher/src/app/api",
        "to": "standalone-launcher",
        "filter": "preload.game.js"
    }]

And it doesnt show up in the app.asar

@bennymeg
Copy link
Owner

bennymeg commented May 16, 2022

As of v13 the preload scripts naming had been changed to ([name].)?preload.ts (i.e. main.preload.ts, preload.ts)
As long as you keep this naming role and keep all the preload scripts in the api folder everything should be handled out of the box.
Please test in again with the latest release and let me know if you still having issues.

@Gerolmed
Copy link
Author

Works fine now. thx a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants