ember-cli-deploy / ember-cli-deploy/ember-cli-deploy-build

Windows: distFiles contain backslashes since glob v10, producing broken S3 keys downstream

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

説明

### Summary

`ember-cli-deploy-build@3.0.0` builds `context.distFiles` with:

```js
distFiles: glob.sync('**/*', { cwd: outputPath, nodir: true, dot: true })
```

and depends on `glob@^10.2.6`. Since the glob v9 rewrite, `glob.sync` returns **platform-native path separators** (this was a breaking change from v7/v8, which always returned `/`). On Windows, `distFiles` therefore come out as `assets\app-.js` instead of `assets/app-.js`.

Downstream plugins use these strings verbatim. `ember-cli-deploy-s3` uploads objects under literal-backslash keys (`assets\app.js` — `%5C` in the URL), so every asset ends up unreachable at its expected `assets/...` URL.

### Observed impact

Deploying the same commit:

- from Linux/macOS → works, objects keyed `assets/...`
- from Windows → site is down: `index.html` (uploaded at the bucket root by `ember-cli-deploy-s3-index`, so unaffected) references `assets/...`, CloudFront finds nothing there and the SPA 404-fallback serves `index.html` in place of every script. With `ember-cli-sri` this surfaces as SRI errors where **every asset reports the same computed hash** (the hash of index.html) — quite misleading until you notice the backslash-keyed objects in the bucket.

### Root cause

glob v9+ returns `\`-separated paths on Windows unless the `posix: true` option is passed (see the "Windows" section of the glob README).

### Suggested fix

Pass `posix: true` to both `glob.sync` calls in `index.js` (lines 24 and 58):

```js
glob.sync('**/*', { cwd: outputPath, nodir: true, dot: true, posix: true })
```

This restores the pre-v9 behavior of always emitting `/`, which is what every consumer of `distFiles` expects (S3 keys, manifest entries, URLs).

### Workaround

Pin glob back to v8 for this package, e.g. with yarn resolutions:

```json
"resolutions": { "ember-cli-deploy-build/glob": "^8.1.0" }
```

### Environment

- ember-cli-deploy-build 3.0.0 (glob resolves to 10.5.0)
- ember-cli-deploy 2.0.0, ember-cli-deploy-s3 5.x, ember-cli-deploy-s3-index 4.x
- Windows (any); Linux/macOS unaffected

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

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

調査の方向性

Open index.js and inspect the glob.sync calls at lines 24 and 58, starting with how they populate distFiles on Windows. Update the glob options so emitted paths use forward slashes, then verify that generated distFiles and downstream S3 object keys use the expected assets/... form.

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

評価

技術スタック
javascript
領域
build-system
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
85/100

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

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