fix: handle hastscript no-default-export + unblock fresh install/start#7793
Open
pranjalisr wants to merge 4 commits intowebpack:mainfrom
Open
fix: handle hastscript no-default-export + unblock fresh install/start#7793pranjalisr wants to merge 4 commits intowebpack:mainfrom
pranjalisr wants to merge 4 commits intowebpack:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
package.json
Outdated
| "workbox-routing": "^7.4.0", | ||
| "workbox-strategies": "^7.4.0", | ||
| "workbox-cacheable-response": "^7.4.0", | ||
| "workbox-expiration": "^7.4.0" |
Contributor
Author
There was a problem hiding this comment.
These were added while resolving the Workbox import issues locally. After reworking the sw.js imports, they’re not strictly necessary as direct dependencies anymore since workbox-webpack-plugin already brings them in.
I can remove them to avoid unnecessary dependency additions and keep the change focused on the hastscript fix.
Contributor
Author
There was a problem hiding this comment.
I have removed them successfully.
Contributor
There was a problem hiding this comment.
i dont know but seems ai generated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing #7789
Summary
This PR fixes the startup failure caused by importing hastscript as a default export, which is not supported in newer versions of the package.
When running yarn start (or npm start) on a fresh setup, the project fails with:
SyntaxError: The requested module 'hastscript' does not provide an export named 'default'
This change updates the hastscript import logic in webpack.common.mjs to safely resolve the export regardless of whether it is provided as:
a default function export
a named h export
or a CommonJS-style default object
Additionally, while reproducing the issue on a clean environment (Node 20+), the following blockers were identified and resolved:
Updated react-tiny-popover to resolve peer dependency conflicts with React 17.
Aligned src/sw.js Workbox imports with Workbox v7.
Added explicit Workbox dependencies to satisfy ESLint and module resolution.
Ensured npm install, npm run lint:js, and npm start all succeed on a fresh clone.
What kind of change does this PR introduce?
Fix.
Did you add tests for your changes?
No.
This change fixes configuration/import issues in the build setup and service worker, and does not modify application runtime logic. Existing functionality remains unchanged.
Does this PR introduce a breaking change?
No.
The changes restore compatibility with newer dependency versions and do not alter public APIs or runtime behavior.
No documentation changes are required.
This PR only restores compatibility with newer versions of hastscript and related dependencies.
Verification:
After applying the changes:
npm installsucceedsnpm run lint:jspassesnpm startruns successfully