Skip to content

[Bug]: Cannot build fonts #558

@rusmux

Description

@rusmux

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

Metadata

Metadata

Assignees

Labels

🐞 bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions