解决vue-pdf 打包后生成worker文件报错问题
- 安装 vue-pdf
npm install --save vue-pdf
- 进入目录 node_modules/worker-loader/dist/index.js
const filename = _loaderUtils2.default.interpolateName(this, options.name || '[hash].worker.js', {
context: options.context || this.rootContext || this.options.context,
regExp: options.regExp
});
修改为:
const filename = _loaderUtils2.default.interpolateName(this, options.name || 'static/js/[hash].worker.js', {
context: options.context || this.rootContext || this.options.context,
regExp: options.regExp
});
static/js/[hash].worker.js //前边换成你打包生成的js路径