Skip to content

Commit e43d7b4

Browse files
authored
fix(wasm): diable postcss temporarily (#2183)
1 parent 88a1011 commit e43d7b4

File tree

4 files changed

+36
-13
lines changed

4 files changed

+36
-13
lines changed

crates/pack-core/src/client/context.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -287,19 +287,28 @@ pub async fn get_client_module_options_context(
287287
}
288288
};
289289

290-
let postcss_transform_options = PostCssTransformOptions {
291-
postcss_package,
292-
config_location: PostCssConfigLocation::ProjectPathOrLocalPath,
293-
..Default::default()
294-
};
295-
let postcss_foreign_transform_options = PostCssTransformOptions {
296-
// For node_modules we don't want to resolve postcss config relative to the file being
297-
// compiled, instead it only uses the project root postcss config.
298-
config_location: PostCssConfigLocation::ProjectPath,
299-
..postcss_transform_options.clone()
300-
};
301-
let enable_postcss_transform = Some(postcss_transform_options.resolved_cell());
302-
let enable_foreign_postcss_transform = Some(postcss_foreign_transform_options.resolved_cell());
290+
let postcss_transform_options =
291+
postcss_package.map(|postcss_package| PostCssTransformOptions {
292+
postcss_package: Some(postcss_package),
293+
config_location: PostCssConfigLocation::ProjectPathOrLocalPath,
294+
..Default::default()
295+
});
296+
let postcss_foreign_transform_options =
297+
postcss_transform_options
298+
.as_ref()
299+
.map(|postcss_transform_options| {
300+
PostCssTransformOptions {
301+
// For node_modules we don't want to resolve postcss config relative to the file being
302+
// compiled, instead it only uses the project root postcss config.
303+
config_location: PostCssConfigLocation::ProjectPath,
304+
..postcss_transform_options.clone()
305+
}
306+
});
307+
308+
let enable_postcss_transform = postcss_transform_options
309+
.map(|postcss_transform_options| postcss_transform_options.resolved_cell());
310+
let enable_foreign_postcss_transform = postcss_foreign_transform_options
311+
.map(|postcss_foreign_transform_options| postcss_foreign_transform_options.resolved_cell());
303312

304313
let module_options_context = ModuleOptionsContext {
305314
ecmascript: EcmascriptOptionsContext {

examples/utooweb-demo/src/demoFiles.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ export const demoFiles = {
33
import React from 'react';
44
import { createRoot } from 'react-dom/client';
55
import Demo from './demo';
6+
import "./index.css";
7+
68
// import SassDemo from './sass-demo';
79
810
// console.log(SassDemo);
911
1012
createRoot(document.getElementById('root')).render(<Demo />);
13+
`,
14+
"src/index.css": `
15+
body {
16+
background-color: aliceblue
17+
}
1118
`,
1219
"src/demo.tsx": `
1320
import React from 'react';

packages/pack/docs/features-list.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@
261261
"featureDetails": "[Webpack `sass-loader`](https://github.com/webpack-contrib/sass-loader)",
262262
"remarks": ""
263263
},
264+
{
265+
"featureLevel2": "`postcss`",
266+
"featureStatus": "",
267+
"featureDetails": "[PostCss](https://postcss.org/)",
268+
"remarks": ""
269+
},
264270
{
265271
"featureLevel2": "`inlineCss`",
266272
"featureStatus": "",

packages/pack/docs/features-list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
| | `removeConsole` || [terser `drop_console`](https://github.com/terser/terser/blob/da1e6fb2acd90e62bac69967718b89d6f00aab79/README.md?plain=1#L734) | |
4040
| Styles | `less` || [Webpack `less-loader`](https://github.com/webpack-contrib/less-loader) | |
4141
| | `sass` || [Webpack `sass-loader`](https://github.com/webpack-contrib/sass-loader) | |
42+
| | `postcss` || [PostCss](https://postcss.org/) | |
4243
| | `inlineCss` || [Webpack `style-loader`](https://github.com/webpack-contrib/style-loader) | |
4344
| | `styledJsx` || [Vercel `styled-jsx`](https://github.com/vercel/styled-jsx) | |
4445
| | `styledComponents` || [Styled Components](https://github.com/styled-components/styled-components) | |

0 commit comments

Comments
 (0)