I neeed some config file in @vue/cli 4.0.5 app and I created manually /vue.config.js with lines :
export const settingsTestriorityLabels = [
{ key: 0, label: 'No00000' },
{ key: 1, label: 'Lowwwwwww' }
]
But trying to use it in my component I got error :
Module Error (from ./node_modules/eslint-loader/index.js):
error: 'settingsTestriorityLabels' is defined but never used (no-unused-vars) at src/views/Tasks/TasksSelection.vue:66:8:
64 | <script>
65 | import appMixin from '@/appMixin'
> 66 | import settingsTestriorityLabels from './../../../vue.config.js'
| ^
67 | // vue.config.js
68 | export default {
but in my component settingsTestriorityLabels declared and used, like :
<template>
<div class="hello">
<h1>{{ msg }}</h1>
TasksSelection.vue +++++++
settingsTestriorityLabels::{{ settingsTestriorityLabels }}
</template>
<script>
import appMixin from '@/appMixin'
import settingsTestriorityLabels from './../../../vue.config.js'
export default {
Is this configuration invalid ?
MODIFIED # 2 : after break I remade my component and run
npm run serve
again but got error in my config file :
s$ npm run serve
> [email protected] serve /mnt/_work_sdb8/wwwroot/lar/VApps/ctasks
> vue-cli-service serve
ERROR Error loading vue.config.js:
ERROR SyntaxError: Unexpected token export
/mnt/_work_sdb8/wwwroot/lar/VApps/ctasks/vue.config.js:1
export const settingsTestriorityLabels = [
^^^^^^
SyntaxError: Unexpected token export
at Module._compile (internal/modules/cjs/loader.js:723:23)
I removed export key having in vue.config.js:
const settingsTestriorityLabels = [
{ key: 0, label: 'No00000' },
{ key: 1, label: 'Lowwwwwww' }
]
Is it valid format of vue.config.js?
Anyway I got the same error :
./src/views/Tasks/TasksSelection.vue
Module Error (from ./node_modules/eslint-loader/index.js):
error: 'settingsTestriorityLabels' is defined but never used (no-unused-vars) at src/views/Tasks/TasksSelection.vue:66:10:
64 | <script>
65 | import appMixin from '@/appMixin'
> 66 | import { settingsTestriorityLabels } from './../../../vue.config.js'
| ^
67 | // vue.config.js
68 | export default {
My component content :
<template>
<div class="hello">
<h1>{{ msg }}</h1>
settingsTestriorityLabels::{{ settingsTestriorityLabels }}
...
</template>
<script>
import appMixin from '@/appMixin'
import { settingsTestriorityLabels } from './../../../vue.config.js'
export default {
data: function () {
return {
count: 0,
settingsTestriorityLabels: [],
I do not see why error and how to fix it as settingsTestriorityLabels is imported and defined ?
MODIFIED # 3 : I found in net examples I tried to fill my vue.config.js with contentL
module.exports = {
settingsTaskPriorityLabels: [
{ key: 0, label: 'No' },
{ key: 1, label: 'Low' },
{ key: 2, label: 'Medium' },
{ key: 3, label: 'High' },
{ key: 4, label: 'Urgent' },
{ key: 5, label: 'Immediate' }
]
}
and got errors:
$ npm run serve
> [email protected] serve /mnt/_work_sdb8/wwwroot/lar/VApps/ctasks
> vue-cli-service serve
ERROR Invalid options in vue.config.js: "settingsTaskPriorityLabels" is not allowed
I tried some more examples, but failed all...
MODIFIED # 4 : I created ./app.settings.js with content :
settingsTaskPriorityLabels = [
{ key: 0, label: 'No' },
{ key: 1, label: 'Low' },
{ key: 2, label: 'Medium' },
{ key: 3, label: 'High' },
{ key: 4, label: 'Urgent' },
{ key: 5, label: 'Immediate' }
]
settingsJsMomentDatetimeFormat = 'Do MMMM, YYYY h:mm A'
But got errors :
error in ./app.settings.js
Module Error (from ./node_modules/eslint-loader/index.js):
error: 'settingsTaskPriorityLabels' is not defined (no-undef) at app.settings.js:1:1:
> 1 | settingsTaskPriorityLabels = [
| ^
2 | { key: 0, label: 'No' },
3 | { key: 1, label: 'Low' },
4 | { key: 2, label: 'Medium' },
error: 'settingsJsMomentDatetimeFormat' is not defined (no-undef) at app.settings.js:10:1:
8 | ]
9 |
> 10 | settingsJsMomentDatetimeFormat = 'Do MMMM, YYYY h:mm A'
| ^
11 |
Which syntax is valid ?