backpack icon indicating copy to clipboard operation
backpack copied to clipboard

Any idea why I need a babel.config.js file and a .babelrc?

Open schester44 opened this issue 6 years ago • 1 comments

Using backpack in a monorepo with a common shared folder.

folder structure is like this:

project1/
    .babelrc
project2/
    .babelrc
shared

Both project1 and project2 have their own backpack config. I'm using babel's module-resolver plugin to resolve the shared folder so I can do stuff like import db from 'shared/db'.

All of this works fine but I get errors indicating babel isn't transpiling the code located in shared. Weirdly enough, copying the .babelrc contents to a babel.config.js fille work as intended.

Here is my .babelrc:


module.exports = {
	presets: ['backpack-core/babel'],
	plugins: [
		'date-fns',
		'@babel/plugin-proposal-nullish-coalescing-operator',
		'@babel/plugin-proposal-optional-chaining',
		[
			'module-resolver',
			{
				root: ['./src'],
				alias: {
					shared: '../shared'
				}
			}
		]
	]
}

Any idea what i'm doing wrong here?

schester44 avatar Feb 01 '20 18:02 schester44

Hi schester44,

Are you still facing this issue? (babel.config.js file and a .babelrc).

p21nc3 avatar Apr 05 '23 13:04 p21nc3