Skip to content

Dynamic imports of routes (code splitting) requires vue.config.js tweak for IE11 support #1642

Closed
@drewtownchi

Description

@drewtownchi

Version

3.0.0-beta.16 - 3.0.0.-rc.3

Reproduction link

https://github.com/drewtownchi/VueRouterTranspile

Steps to reproduce

  1. Create a new vue cli project
  2. Change the about route import in router.js to const About = () => import ("./views/About.vue");
  3. npm run serve
  4. browse to home in IE.
  5. Click on the about link and see the error in console [vue-router] Failed to resolve async component default: TypeError: [object Object] is not iterable
  6. Create a vue.config.js
  7. module.exports = {
    transpileDependencies: [
    "vue-router"
    ]
    }
  8. npm run serve again
  9. Visit the home page and go to the about page again. It works this time.

What is expected?

The page should display with out an error in the console and load the page

What is actually happening?

The page is not loading due to the dynamic import.


Documentation should be provided that dynamic imports or vue router code splitting needs to transpile the vue-router dependency or that an additional polyfill is necessary. I'm not sure what the appropriate workaround is (if it is possible to get this to work without the transpile in vue.config.js)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions