Invalid configuration object output.path is not an absolute path

前端 未结 1 845
不思量自难忘°
不思量自难忘° 2020-12-19 05:19

I try compile \".ts\" to \".js\" with webpack but getting this error, how can I fix this?

Invalid configuration object. Webpack has been initialised using a          


        
1条回答
  •  死守一世寂寞
    2020-12-19 06:01

    output.path requires an absolute path, but you're giving it a relative path ./dist. You need to convert it to an absolute path, for instance by using path.resolve:

    const path = require('path');
    
    module.exports = {
      output: {
        path: path.resolve(__dirname, 'dist'),
        // Your other output options
      },
      // Rest of your config
    };
    

    0 讨论(0)
提交回复
热议问题