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

Namespaced modules' path broken when code is minified #43

aymasse opened this issue Sep 12, 2019 · 5 comments

Namespaced modules' path broken when code is minified #43

aymasse opened this issue Sep 12, 2019 · 5 comments


Copy link

@aymasse aymasse commented Sep 12, 2019


While using version 2.0.4, module declaration is kind of broken in minified code due to the path being pulled from the class' name.
Problem is, the class name is being mangled while using vue-cli in its default configuration.

The result (for me) is that my store only has a single module (named t in my output), even if I declare several modules. This single module contains every state property of my modules but only the mutations and actions of the last declared one.

Copy link

@SaphuA SaphuA commented Sep 30, 2019

For now define your stores the old way:

@Module({ namespacedPath: "foo" })
export default class extends VuexModule { }

You can still define your Vuex-store the new way:

import FooStore from "@/foo/store";
const modules = { ...extractVuexModule(FooStore) };
export const store = new Vuex.Store({ modules });

Copy link

@danielroe danielroe commented Oct 5, 2019

I've closed #42 as it's another expression of this issue - thanks to @SaphuA for the workaround.

If it's useful, see see my repro - and run yarn build && yarn start.

Copy link

@vizv vizv commented Oct 22, 2019


cls.prototype.__namespacedPath__ = cls.prototype.__options__.namespaced.split("/")[0]

I think you setting namespaced to a string should work.

const VuexModule = createModule({
  namespaced: 'foo',
  strict: false,
  target: "nuxt",

Copy link

@michaelolof michaelolof commented Nov 10, 2019

Hello @aymasse

I've made an update based on the issue raised.
Thanks to @vizv 's suggestion

interface VuexModuleOptions {
  namespaced ?:string;

I've modified the namespaced option to take only a string.

Copy link

@SaphuA SaphuA commented Nov 11, 2019

works perfectly now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants