canvas-editor-plugin icon indicating copy to clipboard operation
canvas-editor-plugin copied to clipboard

插件引入时保错

Open PhoneixT opened this issue 1 year ago • 5 comments

Module parse failed: Unexpected token (6675:253) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders (Source code omitted for this binary file)

image

PhoneixT avatar Apr 01 '24 07:04 PhoneixT

download docx.js

whiteWeb11 avatar Apr 25 '24 03:04 whiteWeb11

解决了吗? 安装docx.js还是这个错

zhangqw2 avatar May 11 '24 09:05 zhangqw2

创建一个新项目引入可以,在旧的项目引入就报这个错

zhangqw2 avatar May 11 '24 09:05 zhangqw2

@PhoneixT 有解决吗?

zhangqw2 avatar May 14 '24 01:05 zhangqw2

config.module
  .rule('docx')
  .test(/node_modules\/@hufe921\/canvas-editor-plugin-docx\/dist\/docx.js/)
  .use()
  .loader('babel-loader')
  .end()

指定加载器为babel-loader可以

zhangqw2 avatar May 14 '24 04:05 zhangqw2

指定加载器为babel-loader 会出现新的错误

1203086522 avatar Jun 23 '24 10:06 1203086522

config.module .rule('docx') .test(/node_modules[\/]@hufe921[\/]canvas-editor-plugin-docx[\/]dist[\/]docx.js/) .use() .loader('babel-loader') .end() windous系统用这个,windows系统和mac系统在路径引用方式上有区别

zhangqw2 avatar Jun 24 '24 07:06 zhangqw2

这个问题有解决方案吗,上面都试了 不行

LeslieCheung-FCC avatar Jul 20 '24 12:07 LeslieCheung-FCC

download docx.js

下载之后也报了

LeslieCheung-FCC avatar Jul 22 '24 01:07 LeslieCheung-FCC

插件里面已经下载了,你搞清楚自己项目用的加载器是babel-loader还是file-loader,然后用正确路径指定加载器就行

zhangqw2 avatar Jul 22 '24 01:07 zhangqw2

尝试各种 终于解决了,是win系统下路径不识别问题, image

LeslieCheung-FCC avatar Jul 22 '24 03:07 LeslieCheung-FCC

正确路径

好的 谢谢 关键问题是【正确路径】,不同系统识别路径有问题。已经解决了

LeslieCheung-FCC avatar Jul 22 '24 03:07 LeslieCheung-FCC

@PhoneixT 有解决吗?

我在 vue.config.js 中 添加了 transpileDependencies: ['@hufe921/canvas-editor-plugin-docx'],

PhoneixT avatar Jul 22 '24 06:07 PhoneixT