Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack paths in Flow Error Out

I'm trying to setup Flow in a new project but my webpack resolve paths are confusing it. I am resolving root folders automatically so that you can use components/Foo instead of ../../../Components/Foo.

Is there a way around this? I tried playing with module.name_mapper= '^components/[a-zA-Z0-9$_]+$' -> 'src/components' but it didn't work.

src/pages/Login.js:5
  5: import View from 'components/View';
                      ^^^^^^^^^^^^^^^^^ components/View. Required module not found
like image 321
SkinnyG33k Avatar asked Oct 19 '22 00:10

SkinnyG33k


1 Answers

This is now supported thanks to jeffmo. This supports module resolution functionality in webpack.

[options]
module.name_mapper='^components\(.*\)$' -> '<PROJECT_ROOT>/components/\1'
module.name_mapper='^actions\(.*\)$' -> '<PROJECT_ROOT>/actions/\1'
module.name_mapper='^containers\(.*\)$' -> '<PROJECT_ROOT>/containers/\1'

https://github.com/facebook/flow/issues/382

https://github.com/cdebotton/react-universal/commit/e57aadbcbd8be4e2031f308187392f44d02b44f9

like image 73
Bryan Naegele Avatar answered Oct 21 '22 21:10

Bryan Naegele