This results in webpacker looking up webpack.yml relative to karma.conf.js location which throws a file not found error:
$ karma start --single-run
06 04 2020 15:07:32.509:ERROR [config]: Invalid config file!
Error: ENOENT: no such file or directory, open '/Users/ts-dexter.leng/projects/cms/app/assets/javascripts/v3/config/webpacker.yml'
at Object.fs.openSync (fs.js:646:18)
at fs.readFileSync (fs.js:551:33)
at Object.<anonymous> (/Users/ts-dexter.leng/projects/cms/node_modules/@rails/webpacker/package/env.js:12:25)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/ts-dexter.leng/projects/cms/node_modules/@rails/webpacker/package/config.js:6:22)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
error Command failed with exit code 1.
I have
karma.conf.js
file inapp/assets/javascripts/v3/karma.conf.js
.My
webpacker.yml
is inconfig/webpacker.yml
.Webpack config is in
config/webpack/test.js
.Karma Config imports webpack config:
This results in
webpacker
looking up webpack.yml relative tokarma.conf.js
location which throws a file not found error:The error seems to have to do with how webpacker resolves paths in env.js