小编Err*_*ila的帖子

如何解决需要适当加载器的 npm 错误?

我使用 vue-chartjs 创建了一个 Vue.js 项目。我尝试重新安装该库,但仍然出现此错误:

error  in ./node_modules/chart.js/dist/chart.esm.js
Module parse failed: Unexpected token (6613:12)
You may need an appropriate loader to handle this file type.
|         if (intermediateIndex1 !== startIndex && intermediateIndex1 !== lastIndex) {
|           decimated.push({
|             ...data[intermediateIndex1],
|             x: avgX,
|           });
 @ ./node_modules/vue-chartjs/es/BaseCharts.js 1:0-29
 @ ./node_modules/vue-chartjs/es/index.js
Run Code Online (Sandbox Code Playgroud)

应用程序.vue:

<template>
  <div id="app"></div>
</template>

<script>
import axios from "axios";
import moment from "moment";
import LineChart from "./components/LineChart";

export default {
  name: "App",
  components: {
    LineChart
  },
}
Run Code Online (Sandbox Code Playgroud)

折线图.vue

<script>
import …
Run Code Online (Sandbox Code Playgroud)

javascript npm vue.js chart.js vue-chartjs

2
推荐指数
1
解决办法
2600
查看次数

标签 统计

chart.js ×1

javascript ×1

npm ×1

vue-chartjs ×1

vue.js ×1