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

7.0.3 causes webpack errors when used in typescript component tests with webpack #259

Closed
TomaszG-OpenX opened this issue Oct 17, 2024 · 1 comment

Comments

@TomaszG-OpenX
Copy link

Because the bundle contains some *.ts files, the component tests webpack tries to parse them (probably because when they're internally imported, the default references are for .ts files, not .js files).

ERROR in ../../node_modules/cypress-terminal-report/src/collector/LogCollectControlExtended.ts 5:12
Module parse failed: Unexpected token (5:12)
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
| import utils from "../utils";
| import LogCollectorState from "./LogCollectorState";
> import type {ExtendedSupportOptions} from "../installLogsCollector.types";
| import type {MessageData} from "../types";
| 

ERROR in ../../node_modules/cypress-terminal-report/src/collector/LogCollectCypressCommand.ts 9:33
Module parse failed: Unexpected token (9:33)
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
| 
|   register() {
>     const isOfInterest = (options: any) => options.instrument === 'command' &&
|       options.consoleProps &&
|       !this.ignoredCommands.includes(options.name) &&

The above doesn't occur when webpack's ts-loader is configured to NOT exclude node_modules, but that's a bad practice from the performance point of view. Such a config can interfere with other dependencies.

I don't think those TS files are needed in the released bundle, and I believe they can be safely removed.

@TomaszG-OpenX TomaszG-OpenX changed the title Webpack errors when used in typescript component tests with webpack 7.0.3 causes webpack errors when used in typescript component tests with webpack Oct 17, 2024
@archfz
Copy link
Owner

archfz commented Oct 18, 2024

A typo in npmignore !src/**/*d.ts instead of !src/**/*.d.ts caused some ts files to still be included. Released in 7.0.4

@archfz archfz closed this as completed Oct 18, 2024
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

No branches or pull requests

2 participants