-
Notifications
You must be signed in to change notification settings - Fork 340
fix: replace import assertion with readFileSync in rollup configs #1052
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
fix: replace import assertion with readFileSync in rollup configs #1052
Conversation
- Replace 'import packageJson from ./package.json assert { type: 'json' }' with readFileSync
- Fixes build error: SyntaxError: Unexpected identifier 'assert'
- Affects packages/auth and packages/api rollup.config.js files
- Uses Node.js fs.readFileSync which is compatible with Rollup parser
|
@Spiral-Memory can you please check this pr... |
Spiral-Memory
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix @pratheek56. If possible, could you attach a video showing the build succeeding on Linux, as well as on Windows and Mac if available.
|
sure @Spiral-Memory |
|
Instead of using reading, which could be a blocking operation, we could use with { type: 'json' } instead of assert. I think that would work just as well and be non-blocking. Please look into that option. |
|
actually i check and got that readfilesync is good option.. |
|
Please change to with { type: 'json' } |
- Replace readFileSync with 'with { type: 'json' }' import syntax
- Uses newer standard import attributes syntax
Spiral-Memory
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @deepak0x
Hope build is succeeding ?
|
It seems this solution isn’t backward compatible with Node 16. Consider trying and explore similar solution: This approach provides module caching and ensures backward compatibility. |
|
Hi @Spiral-Memory |
|
If we switch to Node 16 or higher, it might cause issues for those still using Node 16. That would mean updating the documentation to require Node > 16, but we haven’t fully tested on versions above 16 yet. I’m looking a solution that’s backward compatible, supports module caching (unlike your initial approach), and works with higher Node versions as well. |
…atibility
- Replace 'with { type: 'json' }' import syntax with createRequire approach
- Add fileURLToPath and path.dirname for explicit path resolution
- Ensures backward compatibility with Node.js 16.19.0
- Fixes build error during yarn install postinstall script
- Affects packages/auth and packages/api rollup.config.js files
|
@Spiral-Memory i addresses your issue |
Spiral-Memory
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
added mac recording... |
|
Thanks for the fix @deepak0x |
Closes #1050
Mac Recording
https://github.com/user-attachments/assets/257f6cb5-2632-4da9-9157-99849ca26934