美文网首页ionic3+
Ionic 3-: ReferenceError: webpac

Ionic 3-: ReferenceError: webpac

作者: IT晴天 | 来源:发表于2020-02-28 16:14 被阅读0次

    一个祖传老代码打包,提示如下错误:

    ReferenceError: webpackJsonp is not defined
    at http://localhost:8100/build/main.js:1:1

    一搜发现应该是使用了新版本的Ionic-App-Scripts导致的:

    This is a breaking change in Ionic-App-Scripts
    https://github.com/ionic-team/ionic-app-scripts/releases/tag/v2.0.0

    src/index.html must be modified to include a new vendor script tag .

    中文意思是:这版本有一个断式变更,src/index.html文件需要一个包含vendor script的标签,即需要添加这一段:

      <script src="build/vendor.js"></script>
    

    而且必须要放在<script src="build/main.js"></script>前面,完成后如下:

    ...
    <body>
    
      <!-- Ionic's root component and where the app will load -->
      <ion-app></ion-app>
    
      <script src="cordova.js"></script>
    
      <!-- The polyfills js is generated during the build process -->
      <script src="build/polyfills.js"></script>
    
      <!-- all code from node_modules directory is here -->
      <script src="build/vendor.js"></script>
    
      <!-- The bundle js is generated during the build process -->
      <script src="build/main.js"></script>
    
    </body>
    

    相关文章

      网友评论

        本文标题:Ionic 3-: ReferenceError: webpac

        本文链接:https://www.haomeiwen.com/subject/lzulhhtx.html