【发布时间】:2022-01-03 13:06:41
【问题描述】:
我开发了一些模板组件,但在生产后构建了包含在纯 HTML 中的 dist js 并将组件用作
<my-comp></my-comp>
在那里不工作,在严格模式下不允许在“包含”上调用删除时出错。
下面是我的模板配置
import { Config } from '@stencil/core'
import { sass } from '@stencil/sass'
export const config: Config = {
namespace: 'mep-components',
srcDir: 'src',
buildEs5: true,
extras: {
cssVarsShim: true,
dynamicImportShim: true,
shadowDomShim: true,
safari10: true,
scriptDataOpts: true,
appendChildSlotFix: false,
cloneNodeFix: false,
slotChildNodesFix: true,
},
outputTargets: [
{
type: 'dist'
},
{
type: 'www'
}
],
devServer: {
reloadStrategy: 'pageReload',
port: 4444
},
plugins: [sass()]
}
下面是包JSON package.json
{
"name": "web-components",
"module": "./dist/index.js",
"collection": "./dist/collection/collection-manifest.json",
"types": "./dist/types/components.d.ts",
"version": "1.0.0",
"description": "",
"main": "./dist/index.cjs.js",
"scripts": {
"start": "stencil build --dev --watch --serve",
"build": "stencil build --prod && node ./src/tasks/after.build.js",
"server": "json-server --watch db.json",
"task": "node ./src/tasks/someTask.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@stencil/core": "^2.6.0",
"moment-timezone": "^0.5.33",
"stencil-click-outside": "^1.7.1",
"uuid": "^8.3.2"
},
"devDependencies": {
"@stencil/sass": "^1.4.1",
"@types/jquery": "^3.5.6",
"chalk": "^4.1.2",
"workbox-build": "^4.3.1"
}
}
【问题讨论】:
-
这应该不是问题,IE11 已经死了,被埋没了,它的供应商多年前就放弃了它。
-
有什么可以用polyfilling做的吗
-
使用 Google,过去使用过很多 polyfill。我最好的建议:拒绝从事 IE 项目。你将不得不付出两次代价,一次是因为必须使用过时的技术,一次是因为你没有学习现代的东西。
-
您是否使用过the
extrasconfig 来支持旧版浏览器?默认情况下,Stencil 不能在 IE11 上运行,但使用 polyfill 可以支持 IE11。通过使用extras配置,旧版浏览器可以下载并运行 polyfill。 -
@YuZhou 我在问题中使用了额外的配置更新了相同的看看。
标签: javascript internet-explorer-11 web-component polyfills stenciljs