javascript - 打包js文件导入bpmn图时webpack失败
问题描述
我需要捆绑一个js文件。
我的项目文件夹
www/
src/
app.js
resources/
newDiagram.bpmn
public/
中src/app.js
,这条线
import diagramXML from './resources/newDiagram.bpmn';
使捆绑失败并出现以下错误
$ ./node_modules/.bin/webpack ./src/app.js -o public/app.bundled.js --mode development
错误
asset main.js 1.9 MiB [emitted] (name: main)
runtime modules 1.13 KiB 5 modules
orphan modules 40 bytes [orphan] 1 module
modules by path ./node_modules/diagram-js/lib/ 568 KiB 187 modules
modules by path ./node_modules/bpmn-js/lib/ 484 KiB 131 modules
modules by path ./node_modules/diagram-js-direct-editing/ 15.1 KiB 3 modules
modules by path ./node_modules/object-refs/ 7.26 KiB
./node_modules/object-refs/index.js 97 bytes [built] [code generated]
./node_modules/object-refs/lib/refs.js 4.43 KiB [built] [code generated]
./node_modules/object-refs/lib/collection.js 2.74 KiB [built] [code generated]
modules by path ./src/ 4.22 KiB
./src/app.js 3.31 KiB [built] [code generated]
./src/resources/newDiagram.bpmn 932 bytes [built] [code generated] [1 error]
13 modules
ERROR in ./src/resources/newDiagram.bpmn 1:0
Module parse failed: Unexpected token (1:0)
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
> <?xml version="1.0" encoding="UTF-8"?>
| <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn">
| <bpmn2:process id="Process_1" isExecutable="false">
@ ./src/app.js 2:0-53
知道为什么吗?
感谢您提供的任何帮助。
解决方案
推荐阅读
- arrays - 如何根据一行中的值对 Swift 中的二维数组列进行排序?
- laravel - 如何在 Laravel 中检查日期验证规则中的年份
- word2vec - 是否建议删除 word2vec 算法中的重复单词?
- javascript - 如何使用作为生成器并能够链接它们的函数来扩展数组?
- python - 如何在 python 中将 csv 中的两列组合为我的 ggplot 的 x 轴?
- java - MD5 - 未定义字符串类型的方法
- json - 以编程方式用数据填充 Firestore 文档
- mysql - 需要为现有项目动态更改时区
- angular - input[ngbdatepicker] 指令的用例
- java - 为什么我的控制台输入没有终止。如果我删除代码 countSwaps(a,size) 则控制台输入终止,否则不会