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.

Fix default ignore pattern to work on Windows

See original GitHub issue

I’m using create-react-app with react-app-rewired to enable making changes to webpack/babel without ejecting.

I’ve added the following config-overrides.js file (a react-app-rewired requirement):

module.exports = function override(config, env) {
	let babelLoader;

	const checkRule = rule => rule.loader && rule.loader.indexOf('babel-loader') > 0;

	config.module.rules.every(rule => {
		if (rule.oneOf) {
			babelLoader = rule.oneOf.find(checkRule);
		} else if (checkRule(rule)) {
			babelLoader = rule.loader;
		}
		return !babelLoader;
	});

	babelLoader.options.babelrc = true;
	return config
}

This make sure to load the .babelrc file with the needed presets:

{
  "plugins": [
    "syntax-dynamic-import"
  ],
  "env": {
    "test": {
      "plugins": [
        "dynamic-import-node"
      ]
    }
  },
  "presets": [
    "env",
    "react",
    "lingui-react"
  ]
}

While this approach is working, extract is failing with the following exception:

Extracting messages from source files:
C:\Development\partner_portal\client\config-overrides.js
C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babel-core\lib\transformation\file\index.js:590
      throw err;
      ^

SyntaxError: C:/Development/partner_portal/client/node_modules/.bin/sha.js: Unexpected token, expected , (2:18)
  1 | #!/bin/sh
> 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
    |                   ^
  3 | 
  4 | case `uname` in
  5 |     *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
    at Parser.pp$5.raise (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:4454:13)
    at Parser.pp.unexpected (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:1761:8)
    at Parser.pp.expect (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:1749:33)
    at Parser.pp$3.parseCallExpressionArguments (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:3564:12)
    at Parser.pp$3.parseSubscripts (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:3533:31)
    at Parser.pp$3.parseExprSubscripts (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:3504:15)
    at Parser.pp$3.parseMaybeUnary (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:3474:19)
    at Parser.pp$3.parseExprOps (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (C:\Users\ofirhe\AppData\Local\Yarn\config\global\node_modules\babylon\lib\index.js:3344:19)

Expected: While I think this exception should be addressed, I think it would also be beneficial to allow specifying the files to include/exclude from the extraction process

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tricoder42commented, Aug 28, 2017

Ah, you’re right! That plugin isn’t part of env preset! Good job! 👍

Thank you for reporting the bug with ignore patterns. I’ll fix it soon.

1reaction
herzasocommented, Aug 28, 2017

Nevermind, I have to add the “transform-object-rest-spread” plugin …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can we add per device global ignore patterns (with defaults ...
Hi! I'm a very happy new user of Syncthing, surprised how easy to use a piece of Open Source software can be! Everything...
Read more >
Eslint: warning File ignored by default. Use a ... - Stack Overflow
Your npm script runs the linter on the .eslintrc.js file and this file is as the comment says File ignored by default. You...
Read more >
Ignore by default hidden system files and other ... - GitHub
Some default patterns are #837. Ignoring files that have the hidden bit set on Windows is possible, so leaving this as an unplanned ......
Read more >
Ignoring Code - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Ignore files in your Git repo - Azure - Microsoft Learn
gitignore file have precedence over patterns in a global .gitignore file. Use an exclude file. You can also add file search pattern entries...
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