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

Cannot export to native code from more than one module #4613

Closed
martinellison opened this issue Feb 14, 2024 · 5 comments
Closed

Cannot export to native code from more than one module #4613

martinellison opened this issue Feb 14, 2024 · 5 comments

Comments

@martinellison
Copy link

If I try something like

export * from "./exports.slint";
export * from "./meta.slint";

then I get an error message re-exporting modules is only allowed once per file.

Also, I can only export to native code from one slint file.

So I can only export to native code from (a) my main slint file and (b) one more file.

But I want to be able to modularise my slint code into several files (modules) and export from all of them to the native code.

Please add this capabilty (or document how to do this).

@FloVanGH
Copy link
Member

Hi,

It's only the export * from that is currently allowed once in a file. What you work is this:

import { MyType } from "./exports.slint";
import { MyMetaType } from "./meta.slint";

export { MyType, MyMetaType }

@ogoffart
Copy link
Member

This is done on purpose, to make sure there can't be conflicts if two files have the same exports

(Commit 7980eda adds a note in the docs)

@martinellison
Copy link
Author

martinellison commented Feb 14, 2024 via email

@Necro-U
Copy link

Necro-U commented Feb 15, 2024

Hello, I have a issue with this. I am using 1.3.2 version of slint and i am exporting 2 views ( MainView and App ) but the native code takes just one of them. Actually the last one that I exported. Here is the explanation:

export MainView:=Window {
    // Style
    width: 500px;
    height: 500px;
    title: "Program";
    background: goldenrod;
    }

This is MainView module and,

import {MainView} from "./index.slint";
import {ROOT_GLOBAL} from "./global.slint";
export {App,MainView}
component App inherits Window {
  height: ROOT-GLOBAL.window-height;
  width: ROOT-GLOBAL.window-width;
  title: @tr("Slint + SurrealismUI + Rust");
  // MainView {}
}

This is where i export the modules. When I export export {App,MainView} like this inative code can see the MainView but it can't see App module. In the other hand if I try to export like export {MainView,App} then it can see App but not MainView.

Why is that happening?

@ogoffart
Copy link
Member

@Necro-U Your issue is different, this is issue #784

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

No branches or pull requests

4 participants