Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
add:changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
admirsaheta committed Sep 13, 2024
1 parent 6d92aea commit 7f346a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/spicy-panthers-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/web-worker': minor
---

- Allow `output.chunkFilename` to be a function or string.
- `compiler.options.output.filename` and `compiler.options.output.chunkFilename` now default to `[name].js` when undefined.
9 changes: 7 additions & 2 deletions packages/web-worker/src/webpack-parts/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,19 @@ export function pitch(this: LoaderContext<Options>, request: string) {
wrapperContent = cachedContent;
} else if (cachedContent == null) {
try {
wrapperContent = this.fs.readFileSync(wrapperModule).toString();
moduleWrapperCache.set(wrapperModule, wrapperContent ?? false);
if (this.fs?.readFileSync) {

Check failure on line 81 in packages/web-worker/src/webpack-parts/loader.ts

View workflow job for this annotation

GitHub Actions / Test (Node 18, React 18)

Delete `·`

Check failure on line 81 in packages/web-worker/src/webpack-parts/loader.ts

View workflow job for this annotation

GitHub Actions / Test (Node 20, React 18)

Delete `·`
wrapperContent = this.fs.readFileSync(wrapperModule).toString();
moduleWrapperCache.set(wrapperModule, wrapperContent ?? false);
} else {
throw new Error("readFileSync is undefined");

Check failure on line 85 in packages/web-worker/src/webpack-parts/loader.ts

View workflow job for this annotation

GitHub Actions / Test (Node 18, React 18)

Replace `"readFileSync·is·undefined"` with `'readFileSync·is·undefined'`

Check failure on line 85 in packages/web-worker/src/webpack-parts/loader.ts

View workflow job for this annotation

GitHub Actions / Test (Node 20, React 18)

Replace `"readFileSync·is·undefined"` with `'readFileSync·is·undefined'`
}
} catch (error) {
moduleWrapperCache.set(wrapperModule, false);
}
}
}

Check failure on line 91 in packages/web-worker/src/webpack-parts/loader.ts

View workflow job for this annotation

GitHub Actions / Test (Node 18, React 18)

Delete `⏎`

Check failure on line 91 in packages/web-worker/src/webpack-parts/loader.ts

View workflow job for this annotation

GitHub Actions / Test (Node 20, React 18)

Delete `⏎`


if (wrapperContent) {
plugin.virtualModules.writeModule(
virtualModule,
Expand Down

0 comments on commit 7f346a9

Please sign in to comment.