Search code examples
webpackwebpack-4

Can't resolve 'src/index.js'


I have webpack and it show entry error:

*ERROR in multi @babel/polyfill src/index.js Module not found: Error: Can't resolve 'src/index.js' in 'F:\webpack\webpack-st\src' @ multi @babel/polyfill src/index.js entry1

Here's my folder structure:

structure

And webpack code that seems to be wrong:

context: path.resolve(__dirname, "src"),
entry: {
    entry: ["@babel/polyfill", "src/index.js"],
},

I tried to change paths of context and entry but nothing happened except error


Solution

  • You have set your context to src, you don't need src/index.js. Just do ./index.js as entry base has been set to src.