jaredpalmer / jaredpalmer/backpack

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

Open
#170 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
4.4k
Forks
164
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the .babelrc files in project1 and project2 with the babel.config.js behavior, then inspect how Backpack resolves Babel configuration for code imported from shared. Reproduce the monorepo structure and module-resolver setup; done means the shared code is transpiled with a documented, consistent configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.