How to ignore test files in webpack with ts-loader

后端 未结 3 773
执念已碎
执念已碎 2021-02-13 19:46

I have a project that runs the test files named \"*.test.ts\" with jest and ts-jest. This is fine but when I launch webpack, I get errors for the test files:

ERR         


        
3条回答
  •  情话喂你
    2021-02-13 20:13

    You can specify a function instead of the regular expression for the loader test property; this can give you a more control.

    test: function (modulePath) {
      return modulePath.endsWith('.ts') && !modulePath.endsWith('test.ts');
    }
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题