question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please add example on using .babelrc settings (by using cacheIdentifier?)

See original GitHub issue

cacheIdentifier: Default is a string composed by the babel-core’s version, the babel-loader’s version, the contents of .babelrc file if it exists and the value of the environment variable BABEL_ENV with a fallback to the NODE_ENV environment variable. This can be set to a custom value to force cache busting if the identifier changes.

Sounds like I could use cacheIdentifier to use my babel settings defined in .babelrc but not sure how to use it. Please advice 😃

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
MrSaintscommented, Feb 15, 2018

I believe if the .babelrc is in a different place you can specify its location using the babelrc option on the query config property.

Tried that, you end up with:

Module build failed: Error: .babelrc must be a boolean, or undefined

It does not look like you can set a fixed location.

You can set a base .babelrc using:

options: {
    extends: path.resolve(__dirname, ".babelrc.js"),
}

Tested on Babel 8. Perfect if you are importing from outside the current working directory.

0reactions
Slapboxcommented, Apr 10, 2019

@loganfsmyth I’ve not been able to get babel-loader@8.0.5 to recognize my .babelrc files in my app folder. I run webpack from my project root and I have a project setup like this:

ProjectRoot/
  babel.config.js
  app/desktop/.babelrc
  webpack_configs/.babelrc

~~The full project has more folders and more .babelrc files, which is why I’m using babel.config.js. ~~

From what I understand Babel-Loader should pick up the .babelrc in the app/desktop folder from what I can tell, but instead I get errors resulting from none of the plugins/presets being defined. I’ve been defining these in parallel in my webpack config, but I’m trying to dry things up.

I didn’t want to make a new issue for something that’s already been discussed to death, but I also can’t find a solution among any of the discussions. If you have any ideas I’d really appreciate it!

Looks like my problem is probably with on of my .babelrc files

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure Babel
Create a file called babel.config.json with the following content at the root of ... for example a dynamic configuration based on the process...
Read more >
Demystifying and Setting up .babelrc | by Anshu Singh
This plugin transforms es2015 static class properties as well as properties declared with the es2016 property initializer syntax. Below is an ...
Read more >
How to specify cacheDirectory option when using babel ...
I can't figure out how to use it with the following webpack setup: var compiler = webpack( { context: path.resolve( __dirname + "/../../"...
Read more >
babel-loader | Yarn - Package Manager
This README is for babel-loader v8/v9 with Babel v7 If you are using legacy Babel v6, see the 7.x branch docs. NPM Status...
Read more >
Babel Loader for Webpack - Morioh
This package allows transpiling JavaScript files using Babel & webpack. webpack 4.x ... Within your webpack configuration object, you'll need to add the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found