Closed alfonsoar closed 1 year ago
Webpack need a specific loader for tsx file, like ts-loader
Thank you for the reply and for looking into this issue. So the main reason we don’t use ts-loader or babel-loader in our webpack config is because of the usage with heft
. Heft actually the build system (the one orchestrating TS --> JS done by tsc
) so this is why there is no need for these loaders. You can read a bit more about why they take this approach here.
Do you have any ideas on if this is something we could support within cypress-react-unit-test
or what we would need to do to support it?
It looks like webpack config path that you are passing here is not correct. It should point direct location of the webpack config to use
const preprocessor = require('cypress-react-unit-test/plugins/load-webpack')
module.exports = (on, config) => {
config.env.webpackFilename = 'rush-rig/library/webpack-shared.config.js'
preprocessor(on, config)
// IMPORTANT to return the config object
return config
}
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
Issue:
When using this tool within the rushstack ecosystem we observe a webpack error when trying to run the unit tests. A couple of concepts tools to keep in mind are:
Rush (Monorepo tool) Heft (Build system, running TS) Rig package (Helps manage Heft build)
Example error:
Reproduction Steps:
I have set up a fresh repository to showcase this issue https://github.com/alfonsoar/rushstack-cypress-react-unit-integration, please follow the README steps to set-up the repo and run the unit tests.
Only the component-1 package has cypress configured.
Link to cypress.json Link to webpack config. --> rush-rig Link to cypress plugin configuration Link to spec file