Unverified Commit f6f07c08 authored by Alex Kirszenberg's avatar Alex Kirszenberg Committed by GitHub

Apply user-defined PostCSS transforms to foreign code (#49463)

We specifically avoid running most transforms on foreign code without
the `transpile_packages` option, but PostCSS transforms should be an
exception.
parent 5aaa6ff6
...@@ -218,10 +218,17 @@ pub async fn get_client_module_options_context( ...@@ -218,10 +218,17 @@ pub async fn get_client_module_options_context(
}, },
)); ));
let postcss_transform_options = Some(PostCssTransformOptions {
postcss_package: Some(get_postcss_package_mapping(project_path)),
..Default::default()
});
let module_options_context = ModuleOptionsContext { let module_options_context = ModuleOptionsContext {
preset_env_versions: Some(env), preset_env_versions: Some(env),
execution_context: Some(execution_context), execution_context: Some(execution_context),
custom_ecma_transform_plugins, custom_ecma_transform_plugins,
// NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.
enable_postcss_transform: postcss_transform_options.clone(),
..Default::default() ..Default::default()
}; };
...@@ -236,10 +243,7 @@ pub async fn get_client_module_options_context( ...@@ -236,10 +243,7 @@ pub async fn get_client_module_options_context(
enable_react_refresh, enable_react_refresh,
enable_styled_components, enable_styled_components,
enable_styled_jsx: true, enable_styled_jsx: true,
enable_postcss_transform: Some(PostCssTransformOptions { enable_postcss_transform: postcss_transform_options,
postcss_package: Some(get_postcss_package_mapping(project_path)),
..Default::default()
}),
enable_webpack_loaders, enable_webpack_loaders,
enable_typescript_transform: Some(tsconfig), enable_typescript_transform: Some(tsconfig),
enable_mdx_rs: mdx_rs_options, enable_mdx_rs: mdx_rs_options,
......
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
"test/development/acceptance-app/dynamic-error.test.ts", "test/development/acceptance-app/dynamic-error.test.ts",
"test/development/basic/legacy-decorators.test.ts", "test/development/basic/legacy-decorators.test.ts",
"test/integration/plugin-mdx-rs/test/index.test.js", "test/integration/plugin-mdx-rs/test/index.test.js",
"test/e2e/app-dir/underscore-ignore-app-paths/underscore-ignore-app-paths.test.ts" "test/e2e/app-dir/underscore-ignore-app-paths/underscore-ignore-app-paths.test.ts",
"test/e2e/postcss-config-cjs/index.test.ts"
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment