我尝试使用 webpack 将“.ts”编译为“.js”,但出现此错误,我该如何解决?
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!"
最佳答案
output.path
需要一个绝对路径,但你给它一个相对路径 ./dist
。您需要将其转换为绝对路径,例如使用 path.resolve
:
const path = require('path');
module.exports = {
output: {
path: path.resolve(__dirname, 'dist'),
// Your other output options
},
// Rest of your config
};
关于javascript - 无效的配置对象 output.path 不是绝对路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43028487/