Last active
May 2, 2024 03:17
-
-
Save brandonb927/9ff5fb63d46d33086deb472f764cecb4 to your computer and use it in GitHub Desktop.
Cypress + Typescript ts-loader option `transpileOnly` config helps with memory-contrained machines if you're not running in the Cypress Dashboard but rather using custom Jenkins CI, etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (on, config) => { | |
// ... | |
const wpOptions = webpack.defaultOptions | |
wpOptions.webpackOptions.resolve = { | |
extensions: ['.ts', '.js'], | |
} | |
wpOptions.webpackOptions.module.rules.push({ | |
test: /\.ts$/, | |
exclude: [/node_modules/], | |
use: [ | |
{ | |
loader: 'ts-loader', | |
options: { | |
transpileOnly: true, // https://github.com/TypeStrong/ts-loader#transpileonly-boolean-defaultfalse | |
}, | |
}, | |
], | |
}) | |
on('file:preprocessor', webpack(wpOptions)) | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@chiptus I don't think this is an issue anymore using recent versions of Cypress, at the time this was a problem in v2 and v3. If that is what you're stuck on, yes you would need to import
webpack
somehow.