11/* eslint-disable global-require */
22const path = require ( 'path' )
3+ const os = require ( 'os' )
34
45const vtkRules = require ( 'vtk.js/Utilities/config/dependency.js' ) . webpack . core
56 . rules
@@ -43,6 +44,13 @@ const moduleConfigRules = [
4344
4445const entry = path . join ( __dirname , './src/index.js' )
4546
47+ // fixes 404 errors getting worker bundles https://github.com/ryanclark/karma-webpack/issues/498#issuecomment-790040818
48+ const output = {
49+ path :
50+ path . join ( os . tmpdir ( ) , '_karma_webpack_' ) +
51+ Math . floor ( Math . random ( ) * 1000000 ) ,
52+ }
53+
4654module . exports = function init ( config ) {
4755 config . set ( {
4856 plugins : [
@@ -56,6 +64,10 @@ module.exports = function init(config) {
5664
5765 basePath : '' ,
5866 frameworks : [ 'tap' , 'webpack' ] ,
67+ proxies : {
68+ '/itk/web-workers/itk-wasm-pipeline.min.worker.js' :
69+ '/base/dist/itk/web-workers/itk-wasm-pipeline.min.worker.js' ,
70+ } ,
5971 files : [
6072 './test/tests.js' ,
6173 {
@@ -100,6 +112,12 @@ module.exports = function init(config) {
100112 served : true ,
101113 included : false ,
102114 } ,
115+ {
116+ pattern : './dist/**' ,
117+ watched : true ,
118+ served : true ,
119+ included : false ,
120+ } ,
103121 {
104122 pattern : './src/UI/reference-ui/dist/referenceUIMachineOptions.js' ,
105123 watched : true ,
@@ -118,13 +136,19 @@ module.exports = function init(config) {
118136 served : true ,
119137 included : false ,
120138 } ,
139+ {
140+ pattern : `${ output . path } /**/*` ,
141+ watched : false ,
142+ included : false ,
143+ } ,
121144 ] ,
122145
123146 preprocessors : {
124147 './test/tests.js' : [ 'webpack' ] ,
125148 } ,
126149
127150 webpack : {
151+ output,
128152 mode : 'development' ,
129153 devtool : 'eval-source-map' ,
130154 module : {
0 commit comments