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

webpack-cli init - Support for webpack version 4 #350

Closed
Legends opened this issue Mar 17, 2018 · 10 comments · Fixed by #356
Closed

webpack-cli init - Support for webpack version 4 #350

Legends opened this issue Mar 17, 2018 · 10 comments · Fixed by #356

Comments

@Legends
Copy link
Member

Legends commented Mar 17, 2018

Do you want to request a feature or report a bug?

  • Feature
    What is the current behavior?
    Creates an old starter template for webpack.config.js
    If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
CommonsChunkPlugin is deprecated and would not expect it in the template.
Add a question which version of webpack the user wants to use.

@EugeneHlushko
Copy link
Member

Not sure it should differentiate version via user input and add an extra level of complexity into the generator, imo just link previous version as you would for installing older webpack in package.json. Whilst i am with you on fixing the writing of webpack4 ready config file including mode. If you want i can up a PR @Legends

@Legends
Copy link
Member Author

Legends commented Mar 19, 2018

@EugeneHlushko
I just recently started to get my hands on stuff like node, webpack, different packages I apologize for if I sometimes ask dumb questions :-)...

So when I do webpack-cli init how can webpack-cli know which version of webpack I will be using?
You mean npm link a specific version of webpack in the current project and the webpack-cli will know what to generate?

Sure, provide a PR.

@EugeneHlushko
Copy link
Member

@Legends
Latest webpack-cli should work by default against current version of webpack (4+). If there is a case where you are using older webpack version lets say 3.10, you could just specify the older webpack-cli version in package.json which does support that older webpack. Starting to add support for older versions via prompts might just get too messy later on if we keep it in one file and continue adding if statements, right now it seems trivial since the difference is not that big, but that might quickly change when webpack version 5 lands and as webpack 4 gets progressed.

Version differentiation can also be achieved by making extra files for that init command to maintain them separately if its worth it and people upvote the feature. E.g.

if (version < 4) {
 return require('./olderversion.js');
} else {
 return require('./currentversion.js');
}

@EugeneHlushko
Copy link
Member

EugeneHlushko commented Mar 20, 2018

@ev1stensberg im on it, pls assign on me for transparency

@Legends
Copy link
Member Author

Legends commented Mar 20, 2018

I use TypeScript and not Babel, but when I create a new configuration I get:

                        {
				test: /\.js$/,
				exclude: /node_modules/,
				loader: 'babel-loader',   <-- I use `ts-loader`

				options: {
					presets: ['env']
				}
			},

@ematipico
Copy link
Contributor

@EugeneHlushko issue assigned to you :)

@evenstensberg
Copy link
Member

@Legends can't you just use file read at the location package.json?

@Legends
Copy link
Member Author

Legends commented Mar 21, 2018

@EugeneHlushko Thanks for the clarification

@Legends Legends closed this as completed Mar 21, 2018
@Legends
Copy link
Member Author

Legends commented Mar 21, 2018

@ev1stensberg Sorry, what do you mean?

@evenstensberg
Copy link
Member

nvm

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

Successfully merging a pull request may close this issue.

4 participants