Skip to content

Commit

Permalink
fix(react): tailwind with rspack should work on generation #27028
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Aug 23, 2024
1 parent 1824267 commit da385d2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/react/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
babelLoaderVersion,
nxRspackVersion,
nxVersion,
postcssLoaderVersion,
} from '../../utils/versions';
import { maybeJs } from '../../utils/maybe-js';
import { installCommonDependencies } from './lib/install-common-dependencies';
Expand Down Expand Up @@ -219,6 +220,15 @@ export async function applicationGeneratorInternal(
framework: 'react',
});
tasks.push(rspackTask);
if (options.style === 'tailwind') {
tasks.push(
addDependenciesToPackageJson(
host,
{},
{ 'postcss-loader': postcssLoaderVersion }
)
);
}
}

if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { Component } from 'react';
<% } if (!minimal) { %>
import NxWelcome from "./nx-welcome";
<% } if (bundler === "rspack") { %>
import '../styles.css';
<% } %>

<% if (classComponent) { %>
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/utils/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const babelPluginStyledComponentsVersion = '1.10.7';
export const tsLibVersion = '^2.3.0';

export const postcssVersion = '8.4.38';
export const postcssLoaderVersion = '8.1.1';
export const tailwindcssVersion = '3.4.3';
export const autoprefixerVersion = '10.4.13';

Expand Down

0 comments on commit da385d2

Please sign in to comment.