Framework 7 Webpack构建错误超过" 500KB"

时间:2018-04-26 15:43:09

标签: javascript webpack vuejs2 babel html-framework-7

概述

我正在构建Progressive Web App种子。

设置

我使用VueJSFramework7Framework7 Vue ComponentsWebpack全部使用Babel进行了转化。

我使用VueJS CLI启动了项目,然后将Framework7和Framework 7 Vue组件添加到Webpack配置中。

正如它在框架7中所述installation框架7模块使用ES-next并需要进行转换。

  

Framework7 ES模块采用ES-next语法,所以不要忘记   启用/配置您的Babel / Buble进行转换

所以我将以下内容添加到Babel Config

{
    test: /\.js$/,
    loader: 'babel-loader',
    // Original: 
    // include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
    // New
    include: [
      resolve('src'),
      resolve('test'),
      resolve('node_modules/webpack-dev-server/client'),
      resolve('node_modules/framework7'),
      resolve('node_modules/framework7-vue'),
      resolve('node_modules/template7'),
      resolve('node_modules/dom7')
    ]
  },

错误

当我尝试运行npm run dev时,我得到以下内容

  • 构建警告消息

    11% building modules 15/18 modules 3 active ...wa-seed/node_modules/events/events.js[BABEL] Note: The code generator has deoptimised the styling of "/Users/mwarner/eu-pwa-seed/node_modules/framework7/dist/framework7.esm.bundle.js" as it exceeds the max of "500KB".

  • 它显示的设备的控制台

    "导出'默认' (导入为' PathToRegexp')未在' path-to-regexp'

  • 中找到
  • 在任何平台iOS,Android或浏览器上都没有呈现

我注释掉了行resolve('node_modules/framework7'),并且它可以正常运行,但应用程序不会在iOS 11以下的任何内容上呈现,因为它不会转换为Framework 7。

1 个答案:

答案 0 :(得分:1)

这不是错误,只是警告信息表示您达到了500K的限制,但您的构建仍然有效。