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

Expose CSS problem #3128

Open
5 tasks done
intpp opened this issue Oct 28, 2024 · 3 comments
Open
5 tasks done

Expose CSS problem #3128

intpp opened this issue Oct 28, 2024 · 3 comments

Comments

@intpp
Copy link

intpp commented Oct 28, 2024

Describe the bug

Exposing of a .css file doesn't work.

Output of rsbuild dev --open:

  Rsbuild v1.0.18

  ➜ Local:    http://localhost:3000/
  ➜ press h + enter to show shortcuts

start   Building...

Unable to compile federated types, Error: compile TS failed, the original command is 'npx tsc --project /.../rsbuild-module-federation-expose-css/node_modules/.federation/tsconfig.e07ef79f09f2fbe10fad1aef5b91acd4.json'

Error: ENOENT: no such file or directory, open '/.../rsbuild-module-federation-expose-css/dist/@mf-types.zip'

Output of npx tsc --project /...rsbuild-module-federation-expose-css/node_modules/.federation/tsconfig.e07ef79f09f2fbe10fad1aef5b91acd4.json:


error TS6054: File '/.../rsbuild-module-federation-expose-css/src/App.css' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
  The file is in the program because:
    Part of 'files' list in tsconfig.json

  node_modules/.federation/tsconfig.e07ef79f09f2fbe10fad1aef5b91acd4.json:28:5
    28     "/.../rsbuild-module-federation-expose-css/src/App.css",
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    File is matched by 'files' list specified here.


Found 1 error.

rsbuild.config.ts:

import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';

export default defineConfig({
  plugins: [
    pluginReact(),
    pluginModuleFederation({
      name: 'federation_provider',
      exposes: {
        './styles': './src/App.css',
      },
      shared: ['react', 'react-dom'],
    }),
  ],
});

Reproduction

https://github.com/intpp/rsbuild-module-federation-expose-css

Used Package Manager

pnpm

System Info

Binaries:
  Node: 20.3.0
  pnpm: 9.12.0

Validations

@ScriptedAlchemy
Copy link
Member

Expose a javascript file that imports it. Css is a side effect. Should be attached to a js module

@intpp
Copy link
Author

intpp commented Oct 30, 2024

I did, and it works, but I saw in the examples that there was an ability to expose the CSS file directly, and I thought that maybe something was broken.

Thanks!

@ScriptedAlchemy
Copy link
Member

Hmmm good point. I'll check it again. I see it still uses the built in plugin and not our enhanced one.

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

2 participants