echarts
echarts copied to clipboard
[Bug] vue-cli-service serve --mode test 运行后报错:ReferenceError: require is not defined
Version
5.6.0
Link to Minimal Reproduction
无,可能与打包出来的成品有关系
Steps to Reproduce
import * as echarts from "echarts/core"; import { TitleComponent, ToolboxComponent, TooltipComponent, GridComponent, LegendComponent, } from "echarts/components"; import { LineChart } from "echarts/charts"; import { UniversalTransition } from "echarts/features"; import { CanvasRenderer } from "echarts/renderers";
echarts.use([
TitleComponent,
ToolboxComponent,
TooltipComponent,
GridComponent,
LegendComponent,
LineChart,
CanvasRenderer,
UniversalTransition,
]);
Current Behavior
--mode test 相关的命令运行的项目无法使用 echarts 报错 ReferenceError: require is not defined;其余命令正常
"scripts": { "serve:dev": "vue-cli-service serve --mode development", "serve:test": "vue-cli-service serve --mode test", "serve:prod": "vue-cli-service serve --mode production", "build:dev": "vue-cli-service build --mode development", "build:test": "vue-cli-service build --mode test", "build:prod": "vue-cli-service build --mode production", "lint": "vue-cli-service lint" }
Expected Behavior
--mode test 相关的命令运行的项目无法使用 echarts 报错 ReferenceError: require is not defined;其余命令正常
"scripts": { "serve:dev": "vue-cli-service serve --mode development", "serve:test": "vue-cli-service serve --mode test", "serve:prod": "vue-cli-service serve --mode production", "build:dev": "vue-cli-service build --mode development", "build:test": "vue-cli-service build --mode test", "build:prod": "vue-cli-service build --mode production", "lint": "vue-cli-service lint" }
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
No response
@Yiwei099 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
BODY
Version
5.6.0
Link to Minimal Reproduction
None, it may be related to the finished product that is packaged
Steps to Reproduce
import * as echarts from "echarts/core"; import { TitleComponent, ToolboxComponent, TooltipComponent, GridComponent, LegendComponent, } from "echarts/components"; import { LineChart } from "echarts/charts"; import { UniversalTransition } from "echarts/features"; import { CanvasRenderer } from "echarts/renderers";
echarts.use([
TitleComponent,
ToolboxComponent,
TooltipComponent,
GridComponent,
LegendComponent,
LineChart,
CanvasRenderer,
UniversalTransition,
]);
Current Behavior
--mode test related commands cannot be used echarts error ReferenceError: require is not defined; the rest of the commands are normal
"scripts": { "serve:dev": "vue-cli-service serve --mode development", "serve:test": "vue-cli-service serve --mode test", "serve:prod": "vue-cli-service serve --mode production", "build:dev": "vue-cli-service build --mode development", "build:test": "vue-cli-service build --mode test", "build:prod": "vue-cli-service build --mode production", "lint": "vue-cli-service lint" }
Expected Behavior
--mode test related commands cannot be used echarts error ReferenceError: require is not defined; the rest of the commands are normal
"scripts": { "serve:dev": "vue-cli-service serve --mode development", "serve:test": "vue-cli-service serve --mode test", "serve:prod": "vue-cli-service serve --mode production", "build:dev": "vue-cli-service build --mode development", "build:test": "vue-cli-service build --mode test", "build:prod": "vue-cli-service build --mode production", "lint": "vue-cli-service lint" }
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
No response
@Yiwei099 Please provide a demo for the issue either with Official Editor, CodePen, CodeSandbox or JSFiddle.