I am having the same problem with a sass file
// cy-ts-preprocessor.ts
import cypressWebpack from '@cypress/webpack-preprocessor'
const webpackOptions = {
resolve: {
extensions: ['.ts', '.tsx'],
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['@babel/plugin-proposal-class-properties'],
},
},
{
test: /\.sass$/i,
use: [
'style-loader',
'css-loader',
{
loader: 'sass-loader',
},
],
},
],
},
}
const options = {
webpackOptions,
watchOptions: {},
}
export default cypressWebpack(options)
and inside of plugin/index.js
// plugin/index.ts
import cypressTypeScriptPreprocessor from './cy-ts-preprocessor'
export default (on, config) => {
on('file:preprocessor', cypressTypeScriptPreprocessor)
}
I am receiving the next error
src/components/action-bar-button/action-bar-button.component.sass:4
background: #ffffff;
^
ParseError: Unexpected token
I also tried with
{
test: /\.(ts|tsx)$/,
exclude: [/node_modules/],
use: [
{
loader: 'ts-loader',
},
],
},
same error