Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when multi entry includes 'index',webpack entry config does not work #10498

Closed
JiamaZhao opened this issue Mar 3, 2020 · 6 comments
Closed
Labels

Comments

@JiamaZhao
Copy link

JiamaZhao commented Mar 3, 2020

Bug report

What is the current behavior?
webpack.config.config.js

const {CleanWebpackPlugin} = require('clean-webpack-plugin');
module.exports = {
    mode: 'development',
    entry: {
        home: './home.js',
        index: './index.js'
    },
    output: {
        filename: "[name].bundle.js"
    },
    plugins: [
        new CleanWebpackPlugin()
    ]
}

I cann't get 2 bundle as I expected.if I rename 'index' to 'home2',it works.
If the current behavior is a bug, please provide the steps to reproduce.

my directory Structure is below:

├── home.js
├── index.js
├── package-lock.json
├── package.json
├── readme.md
└── webpack.config.js

files content:

index.js

console.log('index.js');

home.js

console.log('home.js');

just run 'webpack' in the root directory

What is the expected behavior?
get 2 bundle output, as below:
'home.bundle.js'
'index.bundle.js',
but I just get below one;
'main.bundle.js',

Other relevant information:
webpack version: 4.42.0("webpack-cli": "^4.0.0-beta.2")
Node.js version: v12.13.0
Operating System: macOs
Additional tools:

@sokra
Copy link
Member

sokra commented Mar 3, 2020

Thanks for your report. It would be great if you reduce your issue to a small reproducible example. Best put this example into a github repository together with instructions how to get to the problem.

@JiamaZhao
Copy link
Author

Thanks for your report. It would be great if you reduce your issue to a small reproducible example. Best put this example into a github repository together with instructions how to get to the problem.

it is easy to plicate the problem, if you have a index.js in you root diretory, the 'entry' will be configed as index.js, and get a result 'main.bundle.js', but my entry config is below:

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

i expect to get

     home.bundle.js
    index.bundle.js

you can just try with a lite demo

@Mistyyyy
Copy link

Mistyyyy commented Mar 4, 2020

you should use webpack-cli with the latest version (3.3.11) rather than 4.0.0-beta.2.
this version has been deprecated due to bad publishing so you can't find this version in npm.js

@ysj16
Copy link

ysj16 commented Apr 2, 2020

It perform normally in my environment, maybe you should provide a complete demo.

@Mistyyyy
Copy link

Mistyyyy commented Apr 2, 2020

The issue is fixed in webpack/webpack-cli#1289, @evilebottnawi you can close this issue.

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants