i get the following error when running jest
You appear to be using a native ECMAScript module configuration file, which is only supported when running Babel asynchronously.
but "type": "module"
is set in package.json
and babel.config.js
looks as follows
// babel.config.js
const config = {
presets: [
"@babel/preset-env",
['@babel/preset-react', {runtime: "automatic"}]
],
plugins: [
"@babel/plugin-proposal-class-properties"
],
};
export default config;
everything works when i rename babel.config.js
to babel.config.cjs
and change it to
// babel.config.cjs
module.exports = {
presets: [
"@babel/preset-env",
['@babel/preset-react', {runtime: "automatic"}]
],
plugins: [
"@babel/plugin-proposal-class-properties"
],
};
but i do not want to convert babel babel.config.js
to commonjs or to json. what am i doing wrong? how can i resolve the error?
Comments
Post a Comment