te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - Can the polyfill.ts file be deleted? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Can the polyfill.ts file be deleted? - Stack Overflow

programmeradmin2浏览0评论

I have this polyfill.ts file in my app that have these import statements:

import 'zone.js/dist/zone'; 
import 'core.js';
import 'core-js/modules/es6.map';
import 'regenerator-runtime/runtime';
import 'core-js/es6/reflect';

But upon checking on the console log, it has an Uncaught TypeError in the polyfill.js file (note: error on polyfill.js file, not on the polyfill.ts file)

Is there a way to not load these polyfill files? Is it also possible to delete this polyfill.ts file even though it is auto-created?

I have this polyfill.ts file in my app that have these import statements:

import 'zone.js/dist/zone'; 
import 'core.js';
import 'core-js/modules/es6.map';
import 'regenerator-runtime/runtime';
import 'core-js/es6/reflect';

But upon checking on the console log, it has an Uncaught TypeError in the polyfill.js file (note: error on polyfill.js file, not on the polyfill.ts file)

Is there a way to not load these polyfill files? Is it also possible to delete this polyfill.ts file even though it is auto-created?

Share Improve this question asked Jan 12, 2022 at 6:49 user8080user8080 752 silver badges5 bronze badges 2
  • 1 What is the error? – Nalin Ranjan Commented Jan 12, 2022 at 7:09
  • @NalinRanjan I am receiving this error in the console --> Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' – user8080 Commented Jan 12, 2022 at 9:01
Add a ment  | 

3 Answers 3

Reset to default 10

Since Angular 15, the polyfill file is not required anymore.

You can pass zone.js directly in angular.json

"polyfills": [
  "zone.js"
]

See "CLI Improvements" section in the Angular 15 release blog post.

When building the project,polyfill.ts is used to create polyfill.js build artifact which contains all the polyfills required to support a missing functionality in older browsers.

Is it also possible to delete this polyfill.ts

Try to avoid deleting this file because polyfill.ts contains zone.js polyfill. Your app may produce errors when running on older browsers. You can however remove the ones not required by your project.

Here is the summary of what these polyfills do:

import 'zone.js/dist/zone'; : Internally required by angular to create a wrapper around async tasks for change detection & angular renderer to work properly on older browsers.

import 'core.js'; import 'core-js/es6/reflect'; import 'core-js/modules/es6.map'; : Useful for IE support which misses many of the modern ES6 functionalities. You can remove these if you don't support IE.

import 'regenerator-runtime/runtime'; : Adds polyfill for generator/yield functions.

I was able to delete the polyfills.ts file from my project pletely by following Matthieu Riegler's solution and then removing the "polyfills.ts" from the "files" area of my "src/tsconfig.*.json" files.

发布评论

评论列表(0)

  1. 暂无评论