Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

[plugin:unplugin-vue2-script-setup] Unexpected token, expected "," (1:16) #22

Closed
@Neophen

Description

@Neophen

Hey i have the weirdest issue:

here's the component:

<script setup name="OnThisVoyage">
import { useOrganisationIdProp } from '../../composables/useRouteHelpers.js';
import { provideBaseCardState } from '../../features/useBaseCardState.js';
import Service from '../../classes/Service.js';

import CargoRow from './CargoRow.vue';

const props = defineProps({
  ...useOrganisationIdProp(),
  shipmentId: {
    type: [Number, String],
    required: true,
  },
});

const {
  setStateLoading,
  setStateIdle,
  setStateError,
  setStateNoData,
} = provideBaseCardState();

const cargoes = ref([]);

const fetchCargoes = () => {
  Service.organisation(props.organisationId)
    .shipment(props.shipmentId)
    .voyage()
    .index()
    .onStart(setStateLoading)
    .onSuccess(({ data }) => {
      cargoes.value = data.filter(
        (cargo) => cargo.shipping_id !== props.shipmentId
      );
      setStateIdle();
    })
    .onNoData(setStateNoData)
    .onError(setStateError);
};

onMounted(() => {
  fetchCargoes();
});
</script>

<template>
  <BaseCardWithState
    title="On this voyage"
    no-data-title="No other cargoes on this voyage."
    @retry="fetchCargoes"
  >
    <CargoRow
      v-for="{ cargo_key, shipping_id, commodity } in cargoes"
      :key="cargo_key"
      :shipment-id="shipping_id"
      :commodity="commodity"
      :organisation-id="organisationId"
    />
  </BaseCardWithState>
</template>

When trying to render this component vite throws an error:

[plugin:unplugin-vue2-script-setup] Unexpected token, expected "," (1:16)
/Users/mykolas/Documents/Projects/myg2-frontend/src/components/OrganisationShipments/OnThisVoyage.vue:1:16
1  |  <script setup name="OnThisVoyage">
   |                  ^
2  |  import { useOrganisationIdProp } from '../../composables/useRouteHelpers.js';
3  |  import { provideBaseCardState } from '../../features/useBaseCardState.js';

Screenshot 2021-08-25 at 10 27 05

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions