Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.
This repository was archived by the owner on Mar 5, 2022. It is now read-only.

Error importing sass file with cypess and componentFolder #246

@andrescabana86

Description

@andrescabana86

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions