0

tsconfig.json

"paths": {     
  "themes/*": [
    "assets/themes/*"
  ]
}

projects\myplugin\src\lib\modules\home\components\detail.component.less

@import 'themes/theme.less';

this import working while build and package publish but not working in npm run test.

Error:

@import 'themes/theme.less';
^
Less resolver error:
Webpack resolver error details:
resolve 'themes/theme.less'
Hitesh Thakor
  • 471
  • 2
  • 12

1 Answers1

1

update your jest.config.js and add module mapper

module.exports = {
  // other configurations...
  moduleNameMapper: {
    '^themes/(.*)$': '<rootDir>/assets/themes/$1'
  }
}
Nazrul Chowdhury
  • 1,483
  • 1
  • 5
  • 11