当我使用webpack将打字稿文件捆绑到bundle.js中并执行时,会发生以下错误,
TypeError: Path must be a string. Received undefined
webpack.config.js
const path = require('path');
module.exports = {
target:'node',
entry: './index.js',
// devtool: 'inline-source-map',
mode:'development',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
modules:[
'node_modules'
]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'lib'),
publicPath: ''
},
node:{
'os-locale':'empty'
},
// devtool: 'inline-source-map',
};
在github页面中,可以通过降级来解决它,但是我不想降级我的节点版本。