Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory name containing parenthesis causes TypeScript to not parse properly #409

Open
Daniel15 opened this issue Jun 6, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@Daniel15
Copy link

commented Jun 6, 2019

package.json:

{
  "name": "microbundle-bug",
  "main": "dist/test.js",
  "module": "dist/test.es.js",
  "types": "dist/test.d.ts",
  "source": "index.ts",
  "devDependencies": {
    "microbundle": "^0.11.0"
  }
}

index.ts:

function hello(name: string): string {
  return 'Hello ' + name;
}

console.log(hello('Daniel'));

Command I'm using:

.\node_modules\.bin\microbundle --format es,cjs --no-compress

In a directory name without parenthesis, it works:

C:\temp\microbundle-bug>.\node_modules\.bin\microbundle --format es,cjs --no-compress
node-resolve: setting options.module is deprecated, please override options.mainFields instead
node-resolve: setting options.jsnext is deprecated, please override options.mainFields instead
node-resolve: setting options.module is deprecated, please override options.mainFields instead
node-resolve: setting options.jsnext is deprecated, please override options.mainFields instead
Build "microbundleBug" to dist:
         93 B: test.js.gz
         68 B: test.js.br
         93 B: test.es.js.gz
         68 B: test.es.js.br

In a directory name WITH paranthesis, it fails to parse the TypeScript:

C:\temp\microbundle-bug (lol)>.\node_modules\.bin\microbundle --format es,cjs --no-compress
node-resolve: setting options.module is deprecated, please override options.mainFields instead
node-resolve: setting options.jsnext is deprecated, please override options.mainFields instead
node-resolve: setting options.module is deprecated, please override options.mainFields instead
node-resolve: setting options.jsnext is deprecated, please override options.mainFields instead
(babel plugin) SyntaxError: C:\temp\microbundle-bug (lol)\index.ts: Unexpected token, expected "," (1:19)

> 1 | function hello(name: string): string {
    |                    ^
  2 |   return 'Hello ' + name;
  3 | }
  4 |

at undefined:1:19
SyntaxError: C:\temp\microbundle-bug (lol)\index.ts: Unexpected token, expected "," (1:19)

> 1 | function hello(name: string): string {
    |                    ^
  2 |   return 'Hello ' + name;
  3 | }
  4 |
    at Object.raise (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:6344:17)
    at Object.unexpected (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:7659:16)
    at Object.expect (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:7645:28)
    at Object.parseBindingList (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:7959:14)
    at Object.parseFunctionParams (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:10520:24)
    at Object.parseFunction (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:10496:10)
    at Object.parseFunctionStatement (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:10136:17)
    at Object.parseStatementContent (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:9826:21)
    at Object.parseStatement (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:9788:17)
    at Object.parseBlockOrModuleBlockBody (C:\temp\microbundle-bug (lol)\node_modules\@babel\parser\lib\index.js:10364:25)

wut.

Windows 10, build 1809
Node.js 10.16.0
Yarn 1.16.0

@Daniel15 Daniel15 changed the title TypeScript not working Directory name containing parenthesis causes TypeScript to not parse properly Jun 6, 2019

@ForsakenHarmony

This comment has been minimized.

Copy link
Collaborator

commented Jun 6, 2019

Very weird issue indeed

@ForsakenHarmony

This comment has been minimized.

Copy link
Collaborator

commented Jun 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.