cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.71k stars 3.16k forks source link

Webpack Compilation Error #29407

Open githubakarsh opened 4 months ago

githubakarsh commented 4 months ago

Current behavior

When I import redux store and use a dispatch function. I am getting :

Webpack Compilation Error Module parse failed: Unexpected token (1:0) You may need appropriate loader to handle this file type, currently no loaders are configured to process this file. Se .... <Svg ..... />

Note : We are using file-loader and svg-inline-loader to handle SVG in webpack5

Its bit weird, when I import Store and Slice file to dispatch am getting SVG related compilation error. If I remove the import , there is no compilation error. I am stuck and can't dispatch to the slice of react-redux.

Desired behavior

Test case should be run with out any failure

Test code to reproduce

I cannot add the code here since its a private repo

Cypress Version

13.8.0

Node version

18.18.0

Operating System

windows

Debug Logs

Webpack Compilation Error Module parse failed: Unexpected token (1:0) You may need appropriate loader to handle this file type, currently no loaders are configured to process this file. Se .... <Svg ..... />

Other

We are using file-loader and svg-inline-loader to handle SVG in webpack5

jennifer-shehane commented 4 months ago

I don't think there will be much to go on here without some code or some way to reproduce.

githubakarsh commented 4 months ago

@jennifer-shehane , the code is not public, we cannot share the code here.

The error code :

Webpack Compilation Error Module parse failed: Unexpected token (1:0) You may need appropriate loader to handle this file type, currently no loaders are configured to process this file. Se .... <Svg ..... />

The above are the debug logs when we are trying to import the reducer slice in cypress files . Example :

File name : component.test.cy.js

import { componentSlice } from ''../slices;

error when importing : Webpack Compilation Error Module parse failed: Unexpected token (1:0) You may need appropriate loader to handle this file type, currently no loaders are configured to process this file. Se .... <Svg ..... />

We use : file-loader and svg-inline-loader in webpack and we don't use svg's in reducer files and hence forth we expect we should not be getting the above error when we use "npx cypress open"