There is a file in /path/to/src/index.js
.
In webpack1 I can use "import '/path/to/src'"
to load the index.js
, but it does not work in webpack2, notices that "module not found"
.
So how to config webpack2 to auto load index.js
file?
I had the same trouble. I fixed it by adding this to the webpack config:
resolve: {extensions: ["*", ".js"]},
If you need to expand this or customize it to your config then there's more information on Webpack's site: https://webpack.js.org/configuration/resolve/