Skip to content

How can I use the store of Pinia in the child VueJS application #1753

Discussion options

You must be logged in to vote

I found the solution to reddit. If you build a library with Pina, in the vite.config.ts file you have to add Pinia option in the rollupOptions in external & globals:

export default defineConfig({
  //...
build: {
    commonjsOptions: {
      esmExternals: true,
    },
    lib: {
      entry: resolve(__dirname, 'src/main.ts'),
      name: 'Formbuilder',
      fileName: 'formbuilder-plugin',
    },
    rollupOptions: {
      external: ['vue', 'pinia'],
      output: {
        globals: {
          vue: 'Vue',
          pinia: 'pinia',
        },
      },
    },
  },
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Giildo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant