stylex
stylex copied to clipboard
nextjs: inject is not defined when using an external lib
Describe the issue
// next.config.js
const stylexPlugin = require('@stylexjs/nextjs-plugin');
module.exports = stylexPlugin({
rootDir: __dirname,
})({
transpilePackages: ['@my/ui'],
});
Leads to:
TypeError: _stylexjs_stylex_lib_stylex_inject__WEBPACK_IMPORTED_MODULE_0__ is not a function
I have to use https://github.com/martpie/next-transpile-modules to make it works:
// next.config.js
const stylexPlugin = require('@stylexjs/nextjs-plugin');
const withTM = require('next-transpile-modules')([
'@my/ui',
]);
module.exports = withTM(stylexPlugin({
rootDir: __dirname,
})({}));
But, next-transpile-modules is deprecated, will be archived soon and is expected to be replaced by native transpilePackages
(which does not work for me), and leads to other side issues.
I would like to use the native transpilePackages
option.
Expected behavior
No error.
Steps to reproduce
I am still trying to isolate the issue.
Test case
No response
Additional comments
No response