Array methods `flat` and `flatMap` are not polyfilled
See original GitHub issueVersion
3.6.3
Reproduction link
https://github.com/runarberg/vue-cli-minimal-example
Environment info
npx @vue/cli info
Environment Info:
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
Binaries:
Node: 11.2.0 - ~/.nvm/versions/node/v11.2.0/bin/node
Yarn: Not Found
npm: 6.4.1 - ~/.nvm/versions/node/v11.2.0/bin/npm
Browsers:
Chrome: Not Found
Firefox: 66.0.2
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.0.0-beta.3
@vue/babel-plugin-transform-vue-jsx: 1.0.0-beta.3
@vue/babel-preset-app: 3.6.0
@vue/babel-preset-jsx: 1.0.0-beta.3
@vue/babel-sugar-functional-vue: 1.0.0-beta.3
@vue/babel-sugar-inject-h: 1.0.0-beta.3
@vue/babel-sugar-v-model: 1.0.0-beta.3
@vue/babel-sugar-v-on: 1.0.0-beta.3
@vue/cli-overlay: 3.6.0
@vue/cli-plugin-babel: ^3.6.0 => 3.6.0
@vue/cli-plugin-eslint: ^3.6.0 => 3.6.0
@vue/cli-service: ^3.6.0 => 3.6.0
@vue/cli-shared-utils: 3.6.0
@vue/component-compiler-utils: 2.6.0
@vue/preload-webpack-plugin: 1.1.0
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^5.0.0 => 5.2.2
vue: ^2.6.10 => 2.6.10
vue-eslint-parser: 2.0.3
vue-hot-reload-api: 2.3.3
vue-loader: 15.7.0
vue-style-loader: 4.1.2
vue-template-compiler: ^2.5.21 => 2.6.10
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: Not Found
Steps to reproduce
What is expected?
These array methods should be polyfilled
What is actually happening?
They are not polyfilled
- Open your app in Chrome, Firefox or Safari and see it working.
- Open it in Edge and see an error message:
[Vue warn]: Error in render: "TypeError: Object doesn't support property or method 'flat'"
TypeError: Object doesn't support property or method 'flat'
Note that babel is configured to polyfill any method that is used, this includes Array.from
in the above example.
Also note that Array.prototype.{flat,flatMap}
were approved for stage 4 in at TC-39 last January and have been moved to stable in core-js.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Array.prototype.flatMap() - JavaScript - MDN Web Docs
A function to execute for each element in the array. It should return an array containing new elements of the new array, or...
Read more >flatMap method over array - (flatMap is not a function)
The flatMap() method first maps each element using a mapping function, then flattens the result into a new array. It is identical to...
Read more >Flatten Arrays in Vanilla JavaScript with flat() and flatMap()
An overview of two new methods available on the Array prototype in JavaScript: flat and flatMap.
Read more >JavaScript Array Methods | flat and flatMap - YouTube
Learn how to flatten arrays easily with the flat and flatMap array methods introduced in ES2019. Pretty useful for squashing those nested ...
Read more >How to Use the flat() and flatMap() Methods to Flatten Arrays ...
In JavaScript and likewise in other programming languages, the right word to use is index and not position. JavaScript arrays can contain ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just noticed my app can’t work in IE because of missing
flatMap
.Adding
to
main.js
solved the problem for meWill be fixed once we upgraded to core-js v3 in Vue CLI v4.