browserify / browserify/tinyify

Unexpected Token when minifying three.js and globe.js

オープン
#57 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
405
フォーク
14
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello,

Thank you for this awesome tool.

I am receiving the following error when minifying my project:

```bash
/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:2929
throw err
^

SyntaxError: Unexpected token (7:598206)
at pp$4.raise (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:2927:15)
at pp.unexpected (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:698:10)
at pp$3.parseExprAtom (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:2326:12)
at _class.parseExprAtom (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn-node@1.8.2/node_modules/acorn-node/lib/dynamic-import/index.js:77:117)
at pp$3.parseExprSubscripts (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:2129:21)
at pp$3.parseMaybeUnary (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:2106:19)
at _class.parseMaybeUnary (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn-node@1.8.2/node_modules/acorn-node/lib/private-class-elements/index.js:122:54)
at pp$3.parseExprOps (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:2041:21)
at pp$3.parseMaybeConditional (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:2024:21)
at pp$3.parseMaybeAssign (/home/mina/Documents/PMSoftware/Tender/Tender Attempt - 0003/codebase/globe/node_modules/.pnpm/acorn@7.4.1/node_modules/acorn/dist/acorn.js:1997:21) {
pos: 602507,
loc: Position { line: 7, column: 598206 },
raisedAt: 602508
}

Node.js v22.5.1
```
Node Version:
```bash
node -v

v22.5.1
```

Command Run:

```bash
browserify -p tinyify index-D9djZuPL.js -o index.js
```

TsConfig:
```bash
cat tsconfig.json

{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"skipLibCheck": true,
"checkJs": false,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": false,
"noUnusedLocals": false,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": [
"src"
]
}
```

Package.json

```bash
cat package.json

{
"name": "globe",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {
"@types/jquery": "^3.5.30",
"jquery": "^3.7.1",
"tinyify": "^4.0.0",
"typescript": "^5.5.3",
"vite": "^5.4.0"
},
"dependencies": {
"@types/three": "^0.167.1",
"globe.gl": "^2.32.5",
"three": "^0.167.1"
}
}
```

The file to be minified can be found on: https://drive.google.com/file/d/1DuqHZAO_CDXJm1prnJArkI4cShG9EIkW/view?usp=sharing

Any help would be greatly appreciated

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

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、提供されたバンドルと package.json に記載されたバージョンを使用して、報告されたコマンド `browserify -p tinyify index-D9djZuPL.js -o index.js` を再現します。報告された parser の位置付近にある生成されたバンドルと、tinyify によるその処理を調査します。コマンドが Unexpected token エラーなしで完了すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js, three.js, vite
領域
build-system, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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