Closed kodai3 closed 1 year ago
@kodai3 in babelModeV7 we just let the babel-loader use the default heuristic for figuring our what the config is, including where the load config from.
I think this page might hold some answers for you: https://babeljs.io/docs/en/config-files
Describe the bug
I have nextjs app trying to migrate storybook v6 to v7.
I have
.babelrc
for nextjs and wantbabelModeV7
to use this file to compile..babelrc
``` { "presets": [ // refs: https://nextjs.org/docs/advanced-features/customizing-babel-config [ "next/babel", { "preset-react": { "runtime": "automatic", "importSource": "@emotion/react" } } ] ], "plugins": ["@emotion/babel-plugin", "babel-plugin-twin", "babel-plugin-macros"] } ```but, storybook fails not being able to compile macros. If I look at the debug command
BABEL_SHOW_CONFIG_FOR=.storybook/preview.js npm run storybook
, we can see the root.babelrc
is not respected. It happens both at v7 and v6 with flags on.log from debug command
``` { "assumptions": {}, "filename": "/To Reproduce
System
Additional context
Tried renaming
.babelrc
to.babelrc.json
and nothing changed.When I write the babel config on the main.js, the debug log shows as epected and works fine.
main.js
``` module.exports = { babel: () => { return { presets: [ // refs: https://nextjs.org/docs/advanced-features/customizing-babel-config [ 'next/babel', { 'preset-react': { runtime: 'automatic', importSource: '@emotion/react', }, }, ], ], plugins: ['@emotion/babel-plugin', 'babel-plugin-twin', 'babel-plugin-macros'], }; }, } ```log
``` { "assumptions": {}, "filename": "/