【问题标题】:Why isn't Nuxt transpiling vendors.app.js?为什么 Nuxt 不转译 vendor.app.js?
【发布时间】:2019-08-21 20:54:10
【问题描述】:

我在使用 Nuxt/Webpack 转换捆绑在 vendors.app.js 中的代码时遇到了一些问题。如果箭头函数和let/const 存在于node_modules 的原始库中,它们仍会在此文件中传送到浏览器。这是一个问题,因为我们需要支持 IE11。

我到处搜索,但没有找到解决方案。我试过了:

1) https://nuxtjs.org/api/configuration-build/#transpile

2) https://github.com/nuxt/nuxt.js/issues/3485

3) 选择退出 @nuxt/babel-preset-app 并在 nuxt.config.js 中尝试我自己的 babel 预设/插件覆盖

我还能尝试什么?

【问题讨论】:

  • 纯粹出于“想知道”,为什么要支持IE11?
  • 您的第一个选择正是您所寻找的
  • 将javascript标签添加到您的帖子中做得很好。许多新用户只是放置他们使用的库,而不是语言本身。继续我的男人。

标签: javascript nuxt.js


【解决方案1】:

原因是 webpack 没有对optimization.splitChunks.cacheGroups 进行任何转换。 因此,请确保您的依赖项是由 es5 导出的。

nuxt splitChunks config

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-05
    • 1970-01-01
    • 2019-09-05
    • 2019-12-06
    • 1970-01-01
    • 2011-04-21
    • 2011-10-10
    相关资源
    最近更新 更多