Skip to content

webpack entry config doesn't work if defaultEntry file existed #1288

@Mistyyyy

Description

@Mistyyyy

What is the current behavior?

webpack.config.js

module.exports = {
  mode: 'development',

  entry: {
    index: './src/entry.js',
  },

  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].bundle.js',
  },

  plugins: [
    new CleanWebpackPlugin()
  ]
}

below is project Directory Structure

├── index.js
├── package.json
├── src
│   ├── a.js
│   └── entry.js
└── webpack.config.js

when running npx webpack, the output ismain.bundle.js , the content of the final bundle includes index.js module and excludes entry.js module

how I know this is a webpack-cli bug rather webpack bug

I debug the program locally

To Reproduce

https://github.com/Mistyyyy/webpack-cli-entry-repo

Expected behavior

output: index.bundle.js

Screenshots

image

I had fix it locally, the reason is BasicGroup has a default entry value and override the config entry value if find defaultEntry file.

If appropriate, I am willing to submit a PR

version

Node: v12.10.0
webpack: 5.0.0-beta.13
webpack-cli: 4.0.0-beta.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions