-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
bug(core): problem with 'fs' when using file preprocessing #120
Comments
@johancblom the usage of fs is only within the plugin which is actually the node environment, not the browser, so things should work fine. Are you using a pre-v1 version or are you using latest? Can you provide a repo where the issue can be reproduced? |
Hi, thank you for getting back to me. I'm using v1.1.0. A test repo is https://github.com/johancblom/paddock-app, but from what you are saying is it the case that the plugin should not end up in a webpack bundle, or, should that part of the code be bundled in a 'node' target area perhaps. |
I see that you are doing preprocessing to get the setup working. It may have to do with the fact that the plugin is going into a webpack bundle, but I thought that Cypress would still handle that case since it is in a plugin instead of the browser/test environment (where the preprocessing is being applied). It might help if you add a global in your webpack config that is for fs, something like: node: {
fs: "empty"
} Out of curiosity, what is the preprocessing for exactly? |
Yes! that did the trick, thank you so much, I was going round in circles. The preprocessing is needed for a cypress unit testing module for vue, see https://github.com/bahmutov/cypress-vue-unit-test#bundling |
Thanks for letting me know it worked, we should add this to a section of the README in case other folks run into the same |
Added a note to the README, so going to close. Thanks for reporting! |
@prescottprue Could you add this to the package.json? "browser": { |
@cchatfield Can you open up a new issue describing what this change would accomplish? Also preferably with a repro for the issue As mentioned above only certain sections of the library are actually meant for node where the rest are loaded in the browser by cypress, so I'm hesitant to in global settings without a full understanding of impact |
I'm having this issue as well, but I'm using Angular with NX to structure my app. The Webpack configuration is intentionally hidden behind the tooling. |
@dpsthree Can you possible open a new issue with a repro? That way I can make sure I'm debugging correctly I though I had this working in an NX app that was React, but maybe I'm remembering wrong |
@prescottprue I'll look into that. Meanwhile, @cchatfield's recommendation worked for me. I modified the cypress-firebase package.json, but I'd rather not do that as a solution. |
created #214 |
I'm trying to create unit tests with Cypress on a Vue project but keep getting an error:
Error: Webpack Compilation Error
./node_modules/cypress-firebase/lib/node-utils.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\johan\VueProjects\paddock-app\node_modules\cypress-firebase\lib'
cypress-io/cypress-documentation#714 says fs is not to be used in cypress as it is sitting in the browser. How do I go about avoiding this webpack compilation issue?
The text was updated successfully, but these errors were encountered: