Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when try to build with this plugin #9

Closed
marcopgordillo opened this issue Aug 12, 2022 · 1 comment
Closed

Error when try to build with this plugin #9

marcopgordillo opened this issue Aug 12, 2022 · 1 comment

Comments

@marcopgordillo
Copy link

Hi I discovered a issue when I try to build with npm run build

I have a vue3 installation with TypeScript, pinia and vue-router

My package.json installation is:

{
    "private": true,
    "scripts": {
        "dev": "vite",
        "build": "vite build",
        "production": "npm run build",
        "test": "vitest",
        "coverage": "vitest run --coverage"
    },
    "devDependencies": {
        "@tailwindcss/aspect-ratio": "^0.4.0",
        "@tailwindcss/forms": "^0.5.2",
        "@tailwindcss/line-clamp": "^0.4.0",
        "@tailwindcss/typography": "^0.5.4",
        "@vitejs/plugin-vue": "^3.0.1",
        "autoprefixer": "^10.4.8",
        "axios": "^0.27",
        "c8": "^7.12.0",
        "laravel-vite-plugin": "^0.5.0",
        "lodash": "^4.17.19",
        "postcss": "^8.4.14",
        "tailwindcss": "^3.1.7",
        "vite": "^3.0.0",
        "vitest": "^0.19.1"
    },
    "dependencies": {
        "@headlessui/vue": "^1.6.7",
        "@heroicons/vue": "^1.0.6",
        "@sentry/tracing": "^7.8.0",
        "@sentry/vue": "^7.8.0",
        "leaflet": "^1.8.0",
        "pinia": "^2.0.17",
        "vue": "^3.2.37",
        "vue-router": "^4.1.3",
        "vue-simple-acl": "^1.2.0"
    }
}

My configuration is:

import { storeToRefs } from 'pinia'
import { createAcl, defineAclRules } from 'vue-simple-acl'
import { useAuthStore } from '@/store'
import router from '@/router'

const rawRules = [
    'roles-list', 'roles-create', 'roles-show', 'roles-update', 'roles-delete',
]

const rules = () => defineAclRules((setRule) => {
    const { user } = storeRefs()
    // setRule('users-list', (user) => user?.permissions.includes('users-list'))
    // setRule('users-create', (user) => user?.permissions.includes('users-create'))
    // setRule('users-show', (user, _user) => user?.permissions.includes('users-list') || user?.id === _user?.id)
    // setRule('users-update', (user, _user) => {
    //     return user?.permissions.includes('users-update') || user?.id === _user?.id
    // })
    // setRule('users-delete', (user, _user) => user?.permissions.includes('users-delete') || user?.id === _user?.id)
    // rawRules.forEach(rule => setRule(rule, (user) => user?.permissions.includes(rule)))
})

export default createAcl({
    user: () => storeRefs().user,
    rules,
    router,
    onDeniedRoute: '/unauthorized',
})

const storeRefs = () => {
    const authStore = useAuthStore()
    const { user } = storeToRefs(authStore)
    return { user }
}

The error that I got is:

Error: 'defineAclRules' is not exported by node_modules/vue-simple-acl/dist/vue-simple-acl.min.js

The status desired is:
The code can be build with the command npm run build for production

@victorybiz
Copy link
Owner

Please update to the latest release v2.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants