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

Can't find a way to use Pinia with gridsome #1647

Open
milo123milo opened this issue Aug 7, 2022 · 1 comment
Open

Can't find a way to use Pinia with gridsome #1647

milo123milo opened this issue Aug 7, 2022 · 1 comment

Comments

@milo123milo
Copy link

Description

Can't find a way to use Pinia with gridsome.

Steps to reproduce

I'm using fresh gridsome project. If anyoun knows how to setup main.js please post here.

Thank you.

@MichaelJRM
Copy link

package.json

"dependencies": {
  ...
  "@vue/composition-api": "^1.7.0",
  "pinia": "^2.0.17",
}

main.js

import { createPinia, PiniaVuePlugin } from 'pinia';

export default function (Vue, { appOptions, head, router }) {
  ...
  Vue.use(PiniaVuePlugin);
  appOptions.pinia = createPinia();
}

gridsome.config.js

module.exports = {
   ...,
   configureWebpack: {
    module: {
      rules: [
        // https://github.com/vuejs/pinia/issues/675
        {
          test: /\.mjs$/,
          include: /node_modules/,
          type: 'javascript/auto',
        },
      ],
    },
  },
}

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