-
environment is exam next.js template and install @tanstack/react-query start ⨯ ./node_modules/@tanstack/query-core/build/modern/mutation.js
SyntaxError: Class private methods are not enabled. Please add `@babel/plugin-transform-private-methods` to your configuration.
149 | }
150 | }
> 151 | #dispatch(action) {
| ^
152 | const reducer = (state) => {
153 | switch (action.type) {
154 | case "failed":
Import trace for requested module:
./node_modules/@tanstack/query-core/build/modern/mutation.js
./node_modules/@tanstack/query-core/build/modern/mutationCache.js
./node_modules/@tanstack/query-core/build/modern/index.js
./node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js
⨯ ./node_modules/@tanstack/query-core/build/modern/mutation.js
SyntaxError: Class private methods are not enabled. Please add `@babel/plugin-transform-private-methods` to your configuration.
149 | }
150 | }
> 151 | #dispatch(action) {
| ^
152 | const reducer = (state) => {
153 | switch (action.type) {
154 | case "failed":
Import trace for requested module:
./node_modules/@tanstack/query-core/build/modern/mutation.js
./node_modules/@tanstack/query-core/build/modern/mutationCache.js
./node_modules/@tanstack/query-core/build/modern/index.js
./node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js i'm install @babel/plugin-transform-private-methods and added .babelrc.js then show other error |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
You have to pass So, the const path = require('path');
const stylexPlugin = require('@stylexjs/nextjs-plugin');
const babelrc = require('./.babelrc.js');
const plugins = babelrc.plugins;
const [_name, options] = plugins.find(
(plugin) => Array.isArray(plugin) && plugin[0] === '@stylexjs/babel-plugin',
);
const rootDir = options.unstable_moduleResolution.rootDir ?? __dirname;
const aliases = options.aliases ?? undefined;
const useCSSLayers = options.useCSSLayers ?? undefined;
module.exports = stylexPlugin({
rootDir,
aliases,
useCSSLayers,
// ADD THIS LINE:
babelConfig: { plugins: ['@babel/plugin-transform-private-methods'], }
})({
transpilePackages: ['@stylexjs/open-props'],
}); You'd also need to make the change to the babelconfig as you've already done. |
Beta Was this translation helpful? Give feedback.
-
@nmn |
Beta Was this translation helpful? Give feedback.
-
worked for me:
|
Beta Was this translation helpful? Give feedback.
You have to pass
@babel/plugin-transform-private-methods
to thebabelConfig.plugins
key to stylex plugin to make this work.So, the
next.config.js
file would need the following change: