Javascriptservices: Invalid configuration object. ... The provided value "<FULL_PATH>/dist" is not an absolute path!

Created on 22 Mar 2017  路  9Comments  路  Source: aspnet/JavaScriptServices

After upgrading webpack to 2.3.0 I get this error (twice, while running "webpack --config webpack.config.vendor.js"):

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

I think it has something to do with this config section:

    const clientBundleConfig = merge(sharedConfig, {
        output: { path: path.join(__dirname, 'wwwroot', 'dist') },
        module: {
            rules: [
                { test: /\.css(\?|$)/, use: extractCSS.extract({ use: 'css-loader' }) }
            ]
        },
        plugins: [
            extractCSS,
            new webpack.DllPlugin({
                path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
                name: '[name]_[hash]'
            })
        ].concat(isDevBuild ? [] : [
            new webpack.optimize.UglifyJsPlugin()
        ])
    });

All work with webpack 2.2.1. Any idea what to change?

All 9 comments

Here is the webpack 2.3.0 release log https://github.com/webpack/webpack/releases

See the Bug Fixes section an "Resolve output path if relative output path is given via CLI", is this the issue?

check the issue here
for now i simply replaced first letter to capital and all worked

const capitalizeFirstLetter = (string) => string.charAt(0).toUpperCase() + string.slice(1);
output: { path: capitalizeFirstLetter(path.join(__dirname, clientBundleOutputDir)) },
path: capitalizeFirstLetter(path.join(__dirname, './ClientApp/dist'))

but they will probably fix it soon

Solved, thank you.

@skorunka Glad you got a solution. Is there something you think we need to change in the default templates, or was the problem something specific to your project?

@SteveSandersonMS this seems to be a breaking change in webpack 2.3.0 Issue: https://github.com/webpack/webpack/issues/4530, Even 2.3.1 doesn't seem to have fixed it.

Lowecase vs uppercase battle in windows agains alot of other tools as always. :)

I am having the same problem with 2.3.1.

@moaead 's solution worked for me for now. Thanks

@SteveSandersonMS No, nothing to change, it is exactly as @asadsahi has written.

Actualy I think the following solution is a bit better then the above one:

__dirname = __dirname.charAt(0).toUpperCase() + __dirname.slice(1);

put the above line to both webconfig files right after the first set of constants definition

Agree with @skorunka . Tackling __dirname on a higher level works if there are some other webpack plugins you are using (in my case I was using webpack-dll-plugin) which was still breaking as we don't control its usage of __dirname by that library.

Webpack 2.3.2 fixed the issue. So you no longer need to tweak the config files.

Hi everybody.

I'm simply trying to use webpack but i can't solve this error.

This is my webpack.config.js :

entry: './main.js',
output: {
path:'/js',
filename: './bundle.js',
},
and the output is:
Hash: d4ed964f3c24ef712293
Version: webpack 4.10.2
Time: 27081ms
Built at: 2018-05-31 16:56:46
Asset Size Chunks Chunk Names
./bundle.js 108 KiB 0 [emitted] main
Entrypoint main = ./bundle.js
[8] ./node_modules/css-loader!./app.css 259 bytes {0} [built]
[9] ./app.css 1.04 KiB {0} [built]
[10] ./App.jsx 2.44 KiB {0} [built]
[20] ./main.js 470 bytes {0} [built]
+ 17 hidden modules

but the bundle.js is not created on selected location.
any one please help me .
Please urgent.

Was this page helpful?
0 / 5 - 0 ratings