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

Script can't be run on IE11 #22

Closed
biohazard999 opened this issue Mar 21, 2019 · 3 comments
Closed

Script can't be run on IE11 #22

biohazard999 opened this issue Mar 21, 2019 · 3 comments

Comments

@biohazard999
Copy link

biohazard999 commented Mar 21, 2019

I've tried a lot to solve that problem but I simply can't get it to work, I'm not sure if it is an issue in vue-typex or I am just too stupid to figure out whats going on.

If I use vuex-typex with IE11 it blows up with the issue described here

SCRIPT5022: Vuex handler functions must not be anonymous. Possible causes: fat-arrow functions, uglify.  To fix, pass a unique name as a second parameter after your callback.

I've prepared a repro here. Any help would be awesome.
Thanks

@rugia813
Copy link
Contributor

rugia813 commented Mar 22, 2019

in navigation.ts, if you assign a name for the functions for mutations or actions, it should work in ie11.

change

  commitOpenState: b.commit(setOpenState),

  dispatchToggleNavigation: b.dispatch(toggleNavigation),
  dispatchCloseNavigation: b.dispatch(closeNavigation),

to

  commitOpenState: b.commit(setOpenState, 'commitOpenState'),

  dispatchToggleNavigation: b.dispatch(toggleNavigation, 'dispatchToggleNavigation'),
  dispatchCloseNavigation: b.dispatch(closeNavigation, 'dispatchCloseNavigation'),

@biohazard999
Copy link
Author

@rugia813 Thanks! That did the trick.
For minification in production i use:

module.exports = {
  // Fix Vuex-typescript in prod: https://github.com/istrib/vuex-typescript/issues/13#issuecomment-409869231
//and Fix vuex-typex in prod https://github.com/mrcrowl/vuex-typex/issues/22
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimizer[0].options.terserOptions = Object.assign(
        {},
        config.optimization.minimizer[0].options.terserOptions,
        {
          ecma: 5,
          compress: {
            keep_fnames: true,
          },
          warnings: false,
          mangle: {
            keep_fnames: true,
          },
        },
      );
    }
  },
}

@mrcrowl
Copy link
Owner

mrcrowl commented Apr 26, 2019

Yes, terser is the way to go for minification.

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

3 participants