Created
November 25, 2024 19:59
-
-
Save javascripter/2d5992e31fa4ed6c08a77a30d3aa3db9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) Meta Platforms, Inc. and affiliates. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
* | |
* | |
*/ | |
const fs = require('fs'); | |
const path = require('path'); | |
function getPackageExports(packageName) { | |
const packageJsonPath = require.resolve(`${packageName}/package.json`); | |
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); | |
if (packageJson.exports) { | |
const exports = {}; | |
for (const key in packageJson.exports) { | |
if (typeof packageJson.exports[key] === 'string') { | |
exports[key] = require.resolve( | |
path.join(packageName, packageJson.exports[key]), | |
); | |
} else if (typeof packageJson.exports[key] === 'object') { | |
exports[key] = getPackageExports(path.join(packageName, key)); | |
} | |
} | |
return exports; | |
} else { | |
return require.resolve(packageName); | |
} | |
} | |
module.exports = { | |
plugins: { | |
'@stylexjs/postcss-plugin': { | |
include: [ | |
'app/**/*.{js,jsx,ts,tsx}', | |
'components/**/*.{js,jsx,ts,tsx}', | |
getPackageExports('@stylexjs/open-props'), | |
], | |
useCSSLayers: true, | |
}, | |
autoprefixer: {}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment