With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
GitHub repo with reproduction can be found here.
ng new nf-postcss-remote-repro
npm install -D tailwindcss @tailwindcss/postcss postcss and setup as described here, but skip the styles.css part.
npm install -D @angular-architects/native-federation
ng g @angular-architects/native-federation:init --project nf-postcss-remote-repro --type remote --port 4201
Update the app as follows to simulate my scenario:
- Create a new Component to expose as Remote Module (
src/app/exposed-modules/feature-1/feature-1.ts); Import TailwindCSS in its styles; Use a TailwindCSS class in the template:
@Component({
selector: 'app-remote-feature-1',
template: `
<div class="p-4">
<button>Click</button>
</div>
`,
styles: `
@import 'tailwindcss';
`,
})
export class Feature1 {}
- Make the app render the Feature-1 component in
app.routes.ts
export const routes: Routes = [
{
path: '',
component: Feature1,
},
];
- Update
federation.config.js to expose the Feature-1 component
exposes: {
"./Feature-1": "./src/app/exposed-modules/feature-1/feature-1.ts",
},
- Run
ng build
- Navigate to
dist/nf-postcss-remote-repro/browser/Feature-1-<some hash>.js and leave the file open (format the file for better readability).
- Navigate to
dist/nf-postcss-remote-repro/browser/main-<some hash>.js and locate the following part at the end
return{imports:o,scopes:{}}})}I().catch(e=>console.error(e)).then(e=>import("./chunk-<some hash>.js")).catch(e=>console.error(e));
- Navigate to that
./chunk-<some hash>.js inside the import function and leave the file open (format the file for better readability).
Expected behavior
The file I expose and load in my Host is the Feature-1-<some hash>.js.
When I check the file's contents, I expect to find the inline component styles to have been run by PostCSS.
Actual behavior:
I can easily see that it didn't by the following observations:
- Inside
Feature-1-<some hash>.js I can see this part:
styles: [
'@layer theme,base,components,utilities;@layer theme{@theme default{ ...
@theme is a custom at-rule, if this file had gone through PostCSS, it'd have been properly replaced.
- If you search for that TailwindCSS class I used
p-4, you'll only find it here
But I expected it to be present in that styles property (it's not).
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
nf-postcss-remote-repro@0.0.0
├── @angular-architects/native-federation@20.1.7
├── @angular-devkit/build-angular@20.3.6
├── @angular/animations@20.3.5
├── @angular/build@20.3.6
├── @angular/cli@20.3.6
├── @angular/common@20.3.5
├── @angular/compiler-cli@20.3.5
├── @angular/compiler@20.3.5
├── @angular/core@20.3.5
├── @angular/forms@20.3.5
├── @angular/platform-browser@20.3.5
├── @angular/router@20.3.5
├── @softarc/native-federation-node@3.3.6
├── @tailwindcss/postcss@4.1.14
├── @types/jasmine@5.1.10
├── es-module-shims@1.10.1
├── jasmine-core@5.8.0
├── karma-chrome-launcher@3.2.0
├── karma-coverage@2.2.1
├── karma-jasmine-html-reporter@2.1.0
├── karma-jasmine@5.1.0
├── karma@6.4.4
├── postcss@8.5.6
├── rxjs@7.8.2
├── tailwindcss@4.1.14
├── tslib@2.8.1
├── typescript@5.8.3
└── zone.js@0.15.1
Node: v22.16.0
Other information
Inside the dist/nf-postcss-remote-repro/browser/main-<some hash>.js file, find the component (selectors: [["app-remote-feature-1"]],).
If you perform the same 2 checks in this file, you'll see a different behavior:
- From this line
styles: [
`@layer theme,base,components,utilities;@layer theme{[_ngcontent-%COMP%]:root, [_nghost-%COMP%]{--font-sans: ...
There's no @theme at-rule. Also, Angular correctly scoped the styles to my component and added [_ngcontent-%COMP%] to the CSS rules.
- If you search for that
p-4 I used, you'll find it in 2 places:
- Inside the
consts: [[1, "p-4"]],, but also
- Inside the
styles property: ...@layer utilities{.p-4[_ngcontent-%COMP%]{padding:calc(var(--spacing) * 4)}}
The exposed Remote Module is "less-complete" than the version I see when I run ng serve.
I would be willing to submit a PR to fix this issue
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
GitHub repo with reproduction can be found here.
ng new nf-postcss-remote-repronpm install -D tailwindcss @tailwindcss/postcss postcssand setup as described here, but skip thestyles.csspart.npm install -D @angular-architects/native-federationng g @angular-architects/native-federation:init --project nf-postcss-remote-repro --type remote --port 4201Update the app as follows to simulate my scenario:
src/app/exposed-modules/feature-1/feature-1.ts); Import TailwindCSS in its styles; Use a TailwindCSS class in the template:app.routes.tsfederation.config.jsto expose the Feature-1 componentng builddist/nf-postcss-remote-repro/browser/Feature-1-<some hash>.jsand leave the file open (format the file for better readability).dist/nf-postcss-remote-repro/browser/main-<some hash>.jsand locate the following part at the end./chunk-<some hash>.jsinside theimportfunction and leave the file open (format the file for better readability).Expected behavior
The file I expose and load in my Host is the
Feature-1-<some hash>.js.When I check the file's contents, I expect to find the inline component styles to have been run by PostCSS.
Actual behavior:
I can easily see that it didn't by the following observations:
Feature-1-<some hash>.jsI can see this part:@themeis a custom at-rule, if this file had gone through PostCSS, it'd have been properly replaced.p-4, you'll only find it hereBut I expected it to be present in that
stylesproperty (it's not).Versions of Native/Module Federation, Angular, Node, Browser, and operating system
nf-postcss-remote-repro@0.0.0
├── @angular-architects/native-federation@20.1.7
├── @angular-devkit/build-angular@20.3.6
├── @angular/animations@20.3.5
├── @angular/build@20.3.6
├── @angular/cli@20.3.6
├── @angular/common@20.3.5
├── @angular/compiler-cli@20.3.5
├── @angular/compiler@20.3.5
├── @angular/core@20.3.5
├── @angular/forms@20.3.5
├── @angular/platform-browser@20.3.5
├── @angular/router@20.3.5
├── @softarc/native-federation-node@3.3.6
├── @tailwindcss/postcss@4.1.14
├── @types/jasmine@5.1.10
├── es-module-shims@1.10.1
├── jasmine-core@5.8.0
├── karma-chrome-launcher@3.2.0
├── karma-coverage@2.2.1
├── karma-jasmine-html-reporter@2.1.0
├── karma-jasmine@5.1.0
├── karma@6.4.4
├── postcss@8.5.6
├── rxjs@7.8.2
├── tailwindcss@4.1.14
├── tslib@2.8.1
├── typescript@5.8.3
└── zone.js@0.15.1
Node: v22.16.0
Other information
Inside the
dist/nf-postcss-remote-repro/browser/main-<some hash>.jsfile, find the component (selectors: [["app-remote-feature-1"]],).If you perform the same 2 checks in this file, you'll see a different behavior:
There's no
@themeat-rule. Also, Angular correctly scoped the styles to my component and added[_ngcontent-%COMP%]to the CSS rules.p-4I used, you'll find it in 2 places:consts: [[1, "p-4"]],, but alsostylesproperty:...@layer utilities{.p-4[_ngcontent-%COMP%]{padding:calc(var(--spacing) * 4)}}The exposed Remote Module is "less-complete" than the version I see when I run
ng serve.I would be willing to submit a PR to fix this issue