cypress-component-configuration: mount issues with SVGs served with SVGR
See original GitHub issueCurrent Behavior
I’ve got an NX monorepo which serves SVGs via svgr. nx serve
works as expected, and all assets are rendered.
However, when I attempt to mount the app for Cypress component testing (configuration generated via nx generate cypress-component-configuration
), I’m seeing the following error:
Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
I suspect that some of the settings in next.config.js
are not being used when generating the configuration for Cypress component testing
Expected Behavior
Components can be mounted in the Cypress spec, just as they are rendered via nx serve
Steps to Reproduce
Minimal GitHub repro: https://github.com/liambutler/cypress-ct-nx-issue/
Instructions are in the readme
Failure Logs
webpack 5.74.0 compiled with 1 error in 29 ms
7 assets
55 modules
ERROR in ../../libs/ui/src/icon/assets/Achievements/one.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
| <circle cx="32" cy="32" r="32" fill="#DFE2E4"/>
| <path fill-rule="evenodd" clip-rule="evenodd" d="M35 21H31V42H35V31.5L40.0092 42.0018L44 42L39.0335 31.5L44 21H40.0092L35 31.5V21Z" fill="#394754"/>
webpack 5.74.0 compiled with 1 error in 31 ms
Environment
Node : 16.16.0
OS : darwin arm64
yarn : 1.22.19
nx : 14.5.10
@nrwl/angular : Not Found
@nrwl/cypress : 14.5.10
@nrwl/detox : Not Found
@nrwl/devkit : 14.5.10
@nrwl/eslint-plugin-nx : 14.5.10
@nrwl/express : Not Found
@nrwl/jest : 14.5.10
@nrwl/js : 14.5.10
@nrwl/linter : 14.5.10
@nrwl/nest : Not Found
@nrwl/next : 14.5.10
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : 14.5.10
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.5.10
@nrwl/web : 14.5.10
@nrwl/workspace : 14.5.10
typescript : 4.7.4
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Makes sense, seeing as it’s in alpha. I’ll give your suggestion a try. Thanks!
Just add anything extra to that example repo and I’ll make sure to test against so it’ll work out of the box for you. 👍