0
点赞
收藏
分享

微信扫一扫

Webpack中的Webpack.config.js配置文件的书写规范

Fifi的天马行空 2022-02-26 阅读 33

运行时出现的问题:ERROR in Entry module not found: Error: Can't resolve ... in ...

解决:

书写格式按照如下写:

//这里采用CommonJs的写法

const path = require('path')

module.exports = {
    entry:  path.join(__dirname, './src/main.js'),
    output: {
        path: path.join(__dirname, './dist'),
        filename: 'bundle.js'
    }
}

PS:上述的书写方式是为了保证entry, output指向的是绝对路径(absolute path)

举报

相关推荐

0 条评论