- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
简短版本
当我在 IE11 中运行应用程序时,我收到一条错误消息,指出 list .js 文件中的 Promise is undefined
。
如何添加 babel-polyfill
或类似内容,使其在执行 list 之前运行?
长版
我正在尝试将 CommonsChunkPlugin 添加到我的 webpack 配置中,以便将第三方(npm 包)脚本拆分到单独的包中。根据 Webpack 2 文档,我设置了“combined implicit common vendor chunks and manifest file ”,它在现代浏览器中运行良好。
我编写了一个函数来确保 block 以正确的顺序包含在我的索引文件中(见下文)。
关于我的两个显式入口点的一些背景:
script-loader
放置到全局命名空间中的旧库。我希望随着时间的推移逐步淘汰这些另外两个( vendor 和 list )是隐式的,并使用 CommonsChunkPlugin 创建。
当我使用 IE11 运行此程序时,出现错误:Promise is undefined
。这似乎是因为 webpack list 本身正在调用 new Promise()
。
在我的主入口点中,我有 import 'babel-polyfill';
。在添加 vendor 和 list 分块之前,这使我能够克服 IE 缺乏 Promise 的问题。但既然我先加载了 manifest.js,我不知道如何以正确的顺序包含它。
我的配置如下:
module.exports = {
entry: {
legacy_libs: './app/libs.js',
main: './app/main.js'
},
...
plugins: [
// Extract third party libraries into a separate vendor bundle.
// Also extract webpack manifest into its own bundle (to prevent vendor hash changing when app source changes)
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function (module) {
return module.context && module.context.indexOf('node_modules') !== -1;
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest'
}),
// Generate index.html file.
// Include script bundles in the right order based on chunk name prefixes.
new HtmlWebpackPlugin({
template: 'app/index.ejs',
chunksSortMode: function (a, b) {
const chunkOrder = ['manifest', 'vendor', 'legacy_libs', 'main'];
const aChunk = chunkOrder.findIndex(chunk => a.names[0].startsWith(chunk));
const bChunk = chunkOrder.findIndex(chunk => b.names[0].startsWith(chunk));
const aValue = (aChunk > -1) ? aChunk : chunkOrder.length;
const bValue = (bChunk > -1) ? bChunk : chunkOrder.length;
return aValue - bValue;
}
})
}
最佳答案
这似乎是 webpack 2.6.0 引入的问题,已经发布了一个错误:https://github.com/webpack/webpack/issues/4916
所以要么等到 bug 修复发布,要么恢复到 2.5.1!
关于IE11 中的 Webpack 隐式 vendor/ list block - Promise 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44160986/
使用 Webpack,支持将代码拆分为不同的包。其中一个选项是指定您想要选择作为分割点的一组模块。 取自 here : var webpack = require("webpack"); module
我正在编写一个依赖于某些导入的库包,但我不确定如何正确处理它。 让我从目录结构开始: go/src/github.com/ ├── developer A/ │ ├── project 1 │
我要在我的 Rails 应用程序中使用 git-submodules 跟踪依赖关系。到目前为止,我已经将 haml、shoulda 和 authlogic 之类的子模块添加到“vendor/plugi
Java 中的 java.vendor 和 java.vm.vendor 属性有区别吗? 看起来两者总是一样的。这是修正假设吗? 如果您知道这两个值不相同的情况,请列出它们。 编辑: 我试图弄清楚哪个
例子:“在测试/虚拟中销售 Rails 应用程序”“为生产销售 Rails 的推荐方法是什么?” 最佳答案 Vendoring 是将所有第 3 方项目(例如插件、gem 甚至 rails)移动到 /v
将我的 Go 服务部署到 Google AppEngine(标准)时,我收到一条错误,描述未找到模块版本,但编译一切正常。 模块位于私有(private) Github 实例上,并 check out
这个问题在这里已经有了答案: Error "can't load package: package my_prog: found packages my_prog and main" (3 个答案)
我是Laravel的新手,我已经安装了PHP,并且我已经在本地服务器上使用过EasyPHP。我也安装了Composer,这里可能会有问题,所以我首先将其安装在PHP低于V8的默认文件夹中。然后我用8.
我正在尝试将一个 Go 项目转换为新的模块标准,但我在一个依赖项上遇到了问题。 该存储库提供了一个库(在本例中为 golang.org/x/net/html)以向该库添加一些功能;这意味着它已经修改了
我在玩 create-react-app和目前的代码拆分。它工作得非常好,直到我开始导入供应商库,这些库将包含在每个块中。 这是我目前的做法: App.js const HomePage = Load
Closed. This question is opinion-based。它当前不接受答案。 想改善这个问题吗?更新问题,以便editing this post用事实和引用来回答。 在6个月前关闭
以下两者似乎都有效: element.style.WebkitFlex = 1; element.style.webkitFlex = 1; 但是哪种语法是标准的? 最佳答案 第一个, eleme
我正在构建来自 github.com/tarm/serial 的示例程序. 案例 1:如果将上述 repo check out 到 $GOPATH/src/github.com/tarm/serial
我需要为构建期间使用的工具使用“vendoring”(github.com/mjibson/esc 和 golang.org/x/tools/cmd/stringer) 以满足我们的来源管理要求。 我
在生产构建我的 vue.js 应用程序后,我看到我的 block vendor 文件太大,这对 Web 性能有影响,屏幕如下: 如何减小此文件的大小? 我尝试通过延迟加载在我的 router.js 中
我必须修改 vendor 文件中的结构。假设这是结构体在 vendor 文件中的方式 type sampleStruct struct { sampleStringvar1 str
我正在使用 styled-components我的 React 项目中的库。 我想在开发期间禁用供应商前缀的生成。 在这么多相似的属性中找到一个指定的 CSS 属性来切换它并在浏览器的开发工具中测试是
我想了解在复习 go 模块和 vendor 目录时遇到错误的原因。显然,在主模块和 vendor 文件夹中具有相同的包会导致错误,我想了解原因。据我了解,如果有go.mod go甚至不应该检查 ven
究竟什么是“贩卖”?你如何定义这个词? 它在不同的编程语言中意味着相同的事情吗?从概念上讲,不看确切的实现。 最佳答案 基于 this answer 定义 here为: Vendoring is th
我有一个具有多个入口点的应用程序。但所有入口点都使用相同的第三方库。我想将这些第三方库单独放在一个单独的文件中。当我按照 documentation 中的步骤操作时,它将我的应用程序代码也移动到第三个
我是一名优秀的程序员,十分优秀!