Bliss
Bliss

Reputation: 21

Cypress - Error: Cannot find module '../../webpack.config.js'

When I try to run cypress, i get the error once the window opens "Error: Cannot find module '../../webpack.config.js'"

In my plugins>index.js, i have this in module.exports webpackOptions: require('../../webpack.config.js'). if i change it to my whole path, its works though.

whole path: Users/username/projects/projA/tests/productA/cypress/webpack.config.js'

in my cypress>tsconfig.json, i have this:

  "paths": {
    "@app": [
      "./"
    ]
  }

in my cypress>webpack.config.js, i have this:

  resolve: {
    extensions: [".js", ".ts", ".d.ts", ".json"],
    alias: {
      '@app': path.resolve(__dirname, "./tests/nav.com/cypress")
    }
  },

SO i'm not sure what's wrong, and i pretty much don't get the alias. How can I set the correct path there....

Upvotes: 1

Views: 3052

Answers (1)

Diogo Rocha
Diogo Rocha

Reputation: 10585

Based on your full path, I think you need to change your require to require('../webpack.config.js').

Upvotes: 2

Related Questions