Skip to content

Webpack CLI seems to create invalid webpack.config.js: #134

Description

@svenvandescheur

There seems to be an issue when running webpack on the configuration created by webpack-cli. Apparently, webpack-cli does not create an absolute path for dist where webpack expects it.

What is the current behavior?

$ webpack-cli

Insecure about some of the questions?

https://github.com/webpack/webpack-cli/blob/master/INIT.md

? Will you be creating multiple bundles? No
? Which module will be the first to enter the application? index.js
? Which folder will your generated bundles be in? [default: dist]:
? Are you going to use this in production? No
? Will you be using ES2015? Yes
? Will you use one of the below CSS solutions? No
? If you want to bundle your CSS files, what will you name the bundle? (press enter to skip)
? Name your 'webpack.[name].js?' [default: 'config']:
test@1.0.0 /Users/svenvandescheur/Desktop/test
├── babel-core@6.24.1
├── babel-loader@7.0.0
└── babel-preset-env@1.4.0

npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.

Congratulations! Your new webpack configuration file has been created!

$ webpack

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.output.path: The provided value "./dist" is not an absolute path!

$ webpack -v

2.5.1

$ webpack-cli -v

1.3.1

$ node -v

v6.2.2

  • os X 10.11.6

$ cat webpack.config.js

const webpack = require('webpack');

/*
 * We've enabled UglifyJSPlugin for you! This minifies your app
 * in order to load faster and run less javascript.
 *
 * https://github.com/webpack-contrib/uglifyjs-webpack-plugin
 *
 */

const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
        entry: 'index.js',
        output: {
                filename: '[name].bundle.js',
                path: './dist'
        },

        module: {
                rules: [
                        {
                                test: /\.js$/,
                                exclude: /node_modules/,
                                loader: 'babel-loader',
                                options: {
                                        presets: ['es2015']
                                }
                        }
                ]
        },

        plugins: [new UglifyJSPlugin()]
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions