Skip to content
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

[Webpack] Error Handling .cs Files During Build Process #157

Closed
Abhijay007 opened this issue Feb 4, 2024 · 2 comments · Fixed by #158
Closed

[Webpack] Error Handling .cs Files During Build Process #157

Abhijay007 opened this issue Feb 4, 2024 · 2 comments · Fixed by #158

Comments

@Abhijay007
Copy link
Contributor

Issue Summary:

Encountering build issues during the yarn install process, specifically an error related to handling .cs files or you can say not having an appropriate loader is present or configured to handle these types of file. This error requires users to manually remove the problematic file, ./node_modules/node-gyp/lib/Find-VisualStudio.cs, before re-running yarn install. you can read more about it here: https://github.com/StatTag/StatWrap?tab=readme-ov-file#build-issues

Why Improvement is Needed:

The current resolution involves manual intervention, which is not sustainable long-term. A permanent solution is necessary to streamline the build process and avoid manual steps.

Suggested Improvement:

To address the issue, webpack needs to be configured to handle .cs files appropriately. This involves adding a loader configuration for .cs files in webpack.config.js.

Steps to Resolve:

The possible resolution I came across, I also tested locally and it worked

  1. Create webpack.config.js: create the webpack.config.js file in the project's root directory.

  2. Add Loader Configuration: Inserted the following loader configuration to handle .cs files:

   module.exports = {
     module: {
       rules: [
         {
           test: /\.cs$/,
           use: 'ts-loader',
           exclude: /node_modules/
         }
       ]
     }
   };

Additional Suggestions:

Feel free to provide alternative solutions or suggestions for resolving this issue, if you want me to create an open PR resolving this issue let me know.

cc: @lrasmus

@lrasmus
Copy link
Contributor

lrasmus commented Feb 8, 2024

@Abhijay007 - amazing, thank you! If you'd like to open a PR, I want to make sure you get proper credit for the fix. I was able to replicate this on my end by adding to configs/webpack.config.base.js. Can we put the change in there instead of creating a new file?

@Abhijay007
Copy link
Contributor Author

@Abhijay007 - amazing, thank you! If you'd like to open a PR, I want to make sure you get proper credit for the fix. I was able to replicate this on my end by adding to configs/webpack.config.base.js. Can we put the change in there instead of creating a new file?

sure, I will try to put this change in that file only, and if that works I will open a PR for this change, thanks for your response

lrasmus added a commit that referenced this issue Feb 14, 2024
(Hopefully) addresses the webpack error that happens when `yarn install` is run
lrasmus added a commit that referenced this issue Feb 14, 2024
Fixes #157 - webpack error during build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants