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

feat: support customProps.cssUrls #19

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TatsuyaYamamoto
Copy link

@TatsuyaYamamoto TatsuyaYamamoto commented Nov 2, 2022

Sorry for creating PR without asking in issues.

Motivation

I want my single-spa application be able to load css provided from root-config.

An application’s bundled css filename sometimes includes hash (index.abcdef.css). Hash text is detemined in build-time, so bundled js file cannot know hashed css file url. In case single-spa(-css), css urls received in opts.cssUrls cannot has build-time hash.

Example

// single-spa root-config
registerApplication({
  name: 'app1',
  activeWhen: '/app1',
  app: () => import('https://example.com/main.build-time-hash.js'),
  customProps: {
    cssUrls: [
      'https://example.com/main.build-time-hash.css', 👈
      'https://example.com/string-determined-after-build-time/main.css' 👈
    ] 
  }
});
// single-spa application
const cssLifecycles = singleSpaCss({
  cssUrls: [],
});

@filoxo
Copy link

filoxo commented Nov 2, 2022

Is this not already supported through the ExposeRuntimeCssAssetsPlugin as noted in the documentation here?

@TatsuyaYamamoto
Copy link
Author

My understanding is that ExposeRuntimeCssAssetsPlugin is for webpack only.

In my case, I want to build single-spa application with Vite, so maybe I should create PR to provide vite-plugin. However, I think it would be better to support as a feature that is not dependent on a specific build tool.

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

Successfully merging this pull request may close these issues.

2 participants