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

[Bug]: Cannot build fonts #558

Closed
rusmux opened this issue Dec 13, 2024 · 5 comments
Closed

[Bug]: Cannot build fonts #558

rusmux opened this issue Dec 13, 2024 · 5 comments
Assignees
Labels
🐞 bug Something isn't working

Comments

@rusmux
Copy link

rusmux commented Dec 13, 2024

Version

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M1
    Memory: 72.06 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 131.0.6778.140
    Safari: 18.2
  npmPackages:
    @rslib/core: ^0.1.3 => 0.1.3

Details

I want to create a lib with shared fonts. In src/fonts.css I have:

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    src: url("./fonts/Inter-Regular.woff2") format("woff2");
}

In rslib.config.mjs:

export default defineConfig({
    source: {
        entry: {
            index: ['./src/**'],
        },
    },
    lib: [{format: 'esm', bundle: false}],
    output: {target: 'web'},
    plugins: [pluginReact()],
});

When I run pnpm build, I get error:

error   Compile error: 
Failed to compile, check the errors for troubleshooting.
File: .../src/fonts.css?__rslib_entry__:1:1
  × Module build failed:
  ╰─▶   × TypeError: Cannot read properties of undefined (reading '__esModule')

Reproduce link

https://github.com/rusmux/rslib-issue-demo

Reproduce Steps

git clone [email protected]:rusmux/rslib-issue-demo.git
cd rslib-issue-demo
pnpm install
pnpm build
@rusmux rusmux added the 🐞 bug Something isn't working label Dec 13, 2024
@Timeless0911
Copy link
Collaborator

Can you provide a reproduction demo to help us address the issue?

@rusmux
Copy link
Author

rusmux commented Dec 13, 2024

@Timeless0911 Added

@Timeless0911
Copy link
Collaborator

Currently, assets support in bundleless mode is still in development, we will track this issue.

@SoonIter
Copy link
Member

SoonIter commented Dec 20, 2024

closed by #582

you can try to configure as below when this pr is released.

output: {
     assetsPrefix: 'auto'
}

@rusmux
Copy link
Author

rusmux commented Dec 20, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants