@@ -1086,6 +1086,51 @@ module.exports = {
10861086 } ) ;
10871087 } ) ;
10881088
1089+ it ( 'PostCSS works when enabled (ESM config)' , function ( done ) {
1090+ const appDir = testSetup . createTestAppDir ( ) ;
1091+
1092+ // Enable ESM so that postcss.config.js is treated as an ES module
1093+ fs . writeFileSync (
1094+ path . join ( appDir , 'package.json' ) ,
1095+ JSON . stringify ( { private : true , type : 'module' } )
1096+ ) ;
1097+
1098+ fs . writeFileSync (
1099+ path . join ( appDir , 'postcss.config.js' ) ,
1100+ `
1101+ export default {
1102+ plugins: {
1103+ 'autoprefixer': {},
1104+ }
1105+ }
1106+ `
1107+ ) ;
1108+
1109+ // Force very old Safari to ensure that autoprefixer will prefix `backdrop-filter`
1110+ fs . writeFileSync ( path . join ( appDir , '.browserslistrc' ) , 'Safari 9' ) ;
1111+
1112+ const config = testSetup . createWebpackConfig ( appDir , 'www/build' , 'dev' ) ;
1113+ config . enableSingleRuntimeChunk ( ) ;
1114+ config . setPublicPath ( '/build' ) ;
1115+ config . addStyleEntry ( 'styles' , [ './css/imports_autoprefixer.css' ] ) ;
1116+ config . addStyleEntry ( 'postcss' , './css/postcss_extension.postcss' ) ;
1117+ config . enablePostCssLoader ( ) ;
1118+
1119+ testSetup . runWebpack ( config , ( webpackAssert ) => {
1120+ webpackAssert . assertOutputFileContains (
1121+ 'styles.css' ,
1122+ '-webkit-backdrop-filter'
1123+ ) ;
1124+
1125+ webpackAssert . assertOutputFileContains (
1126+ 'postcss.css' ,
1127+ '-webkit-backdrop-filter'
1128+ ) ;
1129+
1130+ done ( ) ;
1131+ } ) ;
1132+ } ) ;
1133+
10891134 it ( 'less processes when enabled' , function ( done ) {
10901135 const config = createWebpackConfig ( 'www/build' , 'dev' ) ;
10911136 config . setPublicPath ( '/build' ) ;
@@ -1174,6 +1219,46 @@ module.exports = {
11741219 } ) ;
11751220 } ) ;
11761221
1222+ it ( 'Babel can be configured via babel.config.js (ESM)' , function ( done ) {
1223+ const appDir = testSetup . createTestAppDir ( ) ;
1224+
1225+ // Enable ESM so that babel.config.js is treated as an ES module
1226+ fs . writeFileSync (
1227+ path . join ( appDir , 'package.json' ) ,
1228+ JSON . stringify ( { private : true , type : 'module' } )
1229+ ) ;
1230+
1231+ fs . writeFileSync (
1232+ path . join ( appDir , 'babel.config.js' ) ,
1233+ `
1234+ export default {
1235+ presets: [
1236+ ["@babel/preset-env", {
1237+ targets: {
1238+ chrome: 52
1239+ }
1240+ }]
1241+ ]
1242+ }
1243+ `
1244+ ) ;
1245+
1246+ const config = testSetup . createWebpackConfig ( appDir , 'www/build' , 'dev' ) ;
1247+ config . enableSingleRuntimeChunk ( ) ;
1248+ config . setPublicPath ( '/build' ) ;
1249+ config . addEntry ( 'main' , './js/class-syntax' ) ;
1250+
1251+ testSetup . runWebpack ( config , ( webpackAssert ) => {
1252+ // chrome 52 supports class, so it's not transpiled
1253+ webpackAssert . assertOutputFileContains (
1254+ 'main.js' ,
1255+ 'class A {}'
1256+ ) ;
1257+
1258+ done ( ) ;
1259+ } ) ;
1260+ } ) ;
1261+
11771262 it ( 'Babel can be configured via package.json browserlist' , function ( done ) {
11781263 const cwd = process . cwd ( ) ;
11791264
0 commit comments