Skip to content

webpack-cli init creates invalid path for entry unless you specify leading ./ or an abs. path #162

@nilliams

Description

@nilliams

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

What is the current behavior?
webpack-cli init

Answer index.js to the question 'Which module will be the first to enter the application?'.

Then if you run webpack, fails with error:

ERROR in Entry module not found: Error: Can't resolve 'index.js' in '/Users/.../test-webpack' 

What is the expected behavior?

  1. Should create a webpack config in which the entry name has been transformed similar to the way output.path is handled, e.g.
// instead of
module.exports = {
  entry: 'index.js',
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist')
  }, ...

// should be
module.exports = {
  entry: path.resolve(__dirname, 'index.js'),
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist')
  }, ...
  1. Ideally the question Yeoman asks should be more explicit about the input format it expects too, so I know to type index.js rather than index.

  2. It should possibly also have a default of index.js? That might also help clarify the format too.

Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.

$ webpack-cli --version
1.3.3

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