facebook / facebook/docusaurus

Scaffolded project not working when custom SVGR config placed in parent directory

オープン
#8,646 コメント 11 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug status: needs more information
主要言語
TypeScript
スター
66.2k
フォーク
10k
平均マージ
1日 3時間
マージ済み PR(30日)
52

説明

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Prerequisites

- [X] I'm using the latest version of Docusaurus.
- [X] I have tried the `npm run clear` or `yarn clear` command.
- [X] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [ ] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).

### Description

Hi, i create new project like this:

```bash
npx create-docusaurus@latest docusaurus-try classic --typescript
cd docusaurus-try
npm start
```

After it i get next error:
```

> showcase@0.0.0 start
> docusaurus start

[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/

✖ Client
Compiled with some errors in 935.15ms

SyntaxError: unknown: Unexpected reserved word 'interface'. (3:0)
1 | import * as React from "react";
2 | import { SVGProps } from "react";
> 3 | interface SVGRProps {
| ^
4 | title?: string;
5 | titleId?: string;
6 | }
at parser.next ()
at normalizeFile.next ()
at run.next ()
at transform.next ()
SyntaxError: unknown: Unexpected reserved word 'interface'. (3:0)
1 | import * as React from "react";
2 | import { SVGProps } from "react";
> 3 | interface SVGRProps {
| ^
4 | title?: string;
5 | titleId?: string;
6 | }
at parser.next ()
at normalizeFile.next ()
at run.next ()
at transform.next ()
SyntaxError: unknown: Unexpected reserved word 'interface'. (3:0)
1 | import * as React from "react";
2 | import { SVGProps } from "react";
> 3 | interface SVGRProps {
| ^
4 | title?: string;
5 | titleId?: string;
6 | }
at parser.next ()
at normalizeFile.next ()
at run.next ()
at transform.next ()
client (webpack 5.75.0) compiled with 3 errors
```

It is because in parent directory of docusaurus-try there is a `svgr.config.js` file

### Reproducible demo

_No response_

### Steps to reproduce

1. create and run project by:
```bash
npx create-docusaurus@latest docusaurus-try classic --typescript
cd docusaurus-try
npm start
```
2. see an error in terminal and in browser

### Expected behavior

May be docusaurus should log messages to terminal when it uses configurations outside target directory

### Actual behavior

There is an error:

```

> showcase@0.0.0 start
> docusaurus start

[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/

✖ Client
Compiled with some errors in 935.15ms

SyntaxError: unknown: Unexpected reserved word 'interface'. (3:0)
1 | import * as React from "react";
2 | import { SVGProps } from "react";
> 3 | interface SVGRProps {
| ^
4 | title?: string;
5 | titleId?: string;
6 | }
at parser.next ()
at normalizeFile.next ()
at run.next ()
at transform.next ()
SyntaxError: unknown: Unexpected reserved word 'interface'. (3:0)
1 | import * as React from "react";
2 | import { SVGProps } from "react";
> 3 | interface SVGRProps {
| ^
4 | title?: string;
5 | titleId?: string;
6 | }
at parser.next ()
at normalizeFile.next ()
at run.next ()
at transform.next ()
SyntaxError: unknown: Unexpected reserved word 'interface'. (3:0)
1 | import * as React from "react";
2 | import { SVGProps } from "react";
> 3 | interface SVGRProps {
| ^
4 | title?: string;
5 | titleId?: string;
6 | }
at parser.next ()
at normalizeFile.next ()
at run.next ()
at transform.next ()
client (webpack 5.75.0) compiled with 3 errors
```

### Your environment

- Public source code: non needed
- Public site URL: non needed
- Docusaurus version used: latest 2.3.1
- Environment name and version (e.g. Chrome 89, Node.js 16.15.1): Node.js 16.15.1
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): mac os

### Self-service

- [ ] I'd be willing to fix this bug myself.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。