Skip to content

Commit 05ba449

Browse files
committed
docs(concepts): clarify zero-config entry default and error message
adds a tip to concepts/index.mdx and entry-points.mdx explaining that the zero-config default entry is './src/index.js', and why the error message references './src' rather than './src/index.js'. closes #2035
1 parent ecf45f0 commit 05ba449

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/content/concepts/entry-points.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ contributors:
1212
- adyjs
1313
- anshumanv
1414
- ritikbanger
15+
- saishankar404
1516
---
1617

1718
As mentioned in [Getting Started](/guides/getting-started/#using-a-configuration), there are multiple ways to define the `entry` property in your webpack configuration. We will show you the ways you **can** configure the `entry` property, in addition to explaining why it may be useful to you.
@@ -25,6 +26,8 @@ The result of this process is later written to disk according to the
2526
`output` configuration, which controls where and how the bundled
2627
files are emitted.
2728

29+
T> When running webpack without a configuration file, the entry defaults to `'./src/index.js'`. If that file is missing — even if your `src/` directory exists — webpack will throw: <br /> **`ERROR in Entry module not found: Error: Can't resolve './src'`** <br /><br /> The error says `'./src'` rather than `'./src/index.js'` because webpack resolves the directory first, then fails to find `index.js` inside it. To use a different entry filename, configure the `entry` option as shown in the sections below.
30+
2831
## Single Entry (Shorthand) Syntax
2932

3033
Usage: `entry: string | [string]`

src/content/concepts/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ contributors:
2020
- muhmushtaha
2121
- chenxsan
2222
- RyanGreyling2
23+
- saishankar404
2324
---
2425

2526
At its core, **webpack** is a _static module bundler_ for modern JavaScript applications. When webpack processes your application, it internally builds a [dependency graph](/concepts/dependency-graph/) from one or more _entry points_ and then combines every module your project needs into one or more _bundles_, which are static assets to serve your content from.
@@ -59,6 +60,8 @@ export default {
5960
};
6061
```
6162

63+
T> When running webpack without a configuration file, the entry defaults to `'./src/index.js'`. If that file does not exist — even if your `src/` directory does — webpack will throw: <br /> **`ERROR in Entry module not found: Error: Can't resolve './src'`** <br /><br /> The error says `'./src'` rather than `'./src/index.js'` because webpack resolves the directory first and then fails to find the default `index.js` inside it. To use a different entry filename, add a `webpack.config.js` as shown in the example above.
64+
6265
T> Learn more in the [entry points](/concepts/entry-points) section.
6366

6467
## Output

0 commit comments

Comments
 (0)