data
data copied to clipboard
From Discord: webpack is not mangling @effect/data/mjs/* properly
Summary
The user is reporting an issue with webpack not properly mangling the code of the @effect/data library. They mention that they have encountered this issue before and will try to work around it. Another user expresses confusion about why webpack is skipping the assignment of a symbol. The conversation continues with speculation about the cause of the issue and attempts to reproduce it. However, the user is unable to reproduce the problem with a minimal example. The assistant acknowledges the user's efforts and thanks them for providing valuable information.
Key takeaways:
- There is an issue with webpack not mangling the code of the
@effect/datalibrary properly. - The cause of the issue is unclear and attempts to reproduce it have been unsuccessful so far.
- The user is planning to adapt the library code to work around the problem.
Example article
Webpack is not mangling @effect/data/mjs/* properly
Introduction
In the Effect-TS ecosystem, there have been reports of Webpack not properly mangling the @effect/data/mjs/* module. This issue can cause problems with symbol assignment and can lead to unexpected behavior. In this article, we will explore the issue and discuss potential workarounds.
The Problem
The issue arises when Webpack attempts to assign symbols to the @effect/data/mjs/* module. Instead of assigning the symbol directly or using a conventional assignment, Webpack seems to skip the assignment step altogether. This behavior can result in incorrect symbol references and cause the module to malfunction.
Reproducing the Problem
To reproduce the problem, follow these steps:
- Set up a project with the Effect-TS ecosystem and Webpack.
- Import the
@effect/data/mjs/*module in your code. - Build the project using Webpack.
You may encounter issues with symbol assignment and unexpected behavior during runtime.
Investigation
Upon further investigation, it appears that the problem is not easily reproducible with a minimal example. This suggests that there might be additional factors at play. It is possible that the issue is related to specific configurations or dependencies within the project.
Workarounds
While a direct solution to the Webpack mangling issue is not available at the moment, there are a few workarounds that can be employed:
1. Readapting Library Code
One possible workaround is to modify the library code to work around the Webpack mangling issue. By making adjustments to the code, you can ensure that the symbols are assigned correctly and that the module functions as expected.
2. Investigate Configuration and Dependencies
Since the issue might be related to specific configurations or dependencies, it is worth investigating these aspects of your project. Check if there are any conflicting settings or dependencies that could be causing the problem. Updating or adjusting these configurations might help resolve the issue.
3. File a Bug Report
If you are unable to find a suitable workaround or determine the root cause of the issue, consider filing a bug report with the Webpack or Effect-TS community. Providing a detailed description of the problem, along with any relevant code examples or error messages, can help the community identify and address the issue more effectively.
Conclusion
The Webpack mangling issue with the @effect/data/mjs/* module in the Effect-TS ecosystem can lead to symbol assignment problems and unexpected behavior. While a direct solution is not available, there are workarounds such as readapting library code, investigating configurations and dependencies, and filing bug reports. By employing these strategies, you can mitigate the impact of the issue and continue working with the Effect-TS ecosystem effectively.
Discord thread
https://discord.com/channels/795981131316985866/1130445205225615462
This is x-repo to be ported in every other
Not sure if this is related but if you try:
yarn add -E @effect/[email protected] @effect/[email protected] @effect/[email protected] @effect/match
or
npm i --save-exact @effect/[email protected] @effect/[email protected] @effect/[email protected] @effect/match && npm run postinstall
in
https://github.com/electron-react-boilerplate/electron-react-boilerplate
Throws:
ERROR in dll renderer renderer[0] Module not found: Error: Package path . is not exported from package /electron-react-boilerplate/node_modules/@effect/data (see exports field in /electron-react-boilerplate/node_modules/@effect/data/package.json)
I was trying to use @effect/match but couldn't figure out how to install it
Doesn't seem related but that's also strange, it seems that it is trying to import @effect/data but there is no @effect/data import, there are only modules like @effect/data/X that are mapped with a wildcard in exports to node_modules/@effect/data/X.js
Doesn't seem related but that's also strange, it seems that it is trying to import
@effect/databut there is no@effect/dataimport, there are only modules like@effect/data/Xthat are mapped with a wildcard in exports tonode_modules/@effect/data/X.js
Sadly I do not have enough webpack/packaging knowledge to hint at a solution, the good news is that is it super reproducible, I've also never had that issue before so I guess it must be a common issue that gets solved early on.
Sorry I cannot be of more use 🫡