webpack.config.js

entry

entry: './index.js'

入口文件是 index.js

output

output: {
  path: 'dist/',
  filename: name + '.js',
  sourceMapFilename: name + '.map',
  library: 'axios',
  libraryTarget: 'umd'
},

打包后产生后缀名为 .map 的文件是由于配置了 sourcemap 选项生成的,打包后的文件不容易找到出 bug 对应的源代码的位置,sourcemap 就是来帮我们解决这个问题的,具体配置可以查看官网 devtool 配置 或者其它的 webpack sourcemap 选项多种模式的一些解释

指定 axiosumd 通用模块

Last updated