zoukankan      html  css  js  c++  java
  • webpack打包基本使用过程小案例

    <!DOCTYPE html>
    <html lang="zh-CN">
    
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <link rel="stylesheet" href="  ">
        <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    </head>
    
    <body>
        <script src="./dist/bundle.js"></script>
    </body>
    
    </html>
    import aa from './one.js'
    
    var num = 256;
    console.log(aa(num));
    var add100 = function (a) {
        return a * 100;
    }
    
    export default add100;
    /******/ (function(modules) { // webpackBootstrap
    /******/     // The module cache
    /******/     var installedModules = {};
    /******/
    /******/     // The require function
    /******/     function __webpack_require__(moduleId) {
    /******/
    /******/         // Check if module is in cache
    /******/         if(installedModules[moduleId]) {
    /******/             return installedModules[moduleId].exports;
    /******/         }
    /******/         // Create a new module (and put it into the cache)
    /******/         var module = installedModules[moduleId] = {
    /******/             i: moduleId,
    /******/             l: false,
    /******/             exports: {}
    /******/         };
    /******/
    /******/         // Execute the module function
    /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    /******/
    /******/         // Flag the module as loaded
    /******/         module.l = true;
    /******/
    /******/         // Return the exports of the module
    /******/         return module.exports;
    /******/     }
    /******/
    /******/
    /******/     // expose the modules object (__webpack_modules__)
    /******/     __webpack_require__.m = modules;
    /******/
    /******/     // expose the module cache
    /******/     __webpack_require__.c = installedModules;
    /******/
    /******/     // define getter function for harmony exports
    /******/     __webpack_require__.d = function(exports, name, getter) {
    /******/         if(!__webpack_require__.o(exports, name)) {
    /******/             Object.defineProperty(exports, name, {
    /******/                 configurable: false,
    /******/                 enumerable: true,
    /******/                 get: getter
    /******/             });
    /******/         }
    /******/     };
    /******/
    /******/     // getDefaultExport function for compatibility with non-harmony modules
    /******/     __webpack_require__.n = function(module) {
    /******/         var getter = module && module.__esModule ?
    /******/             function getDefault() { return module['default']; } :
    /******/             function getModuleExports() { return module; };
    /******/         __webpack_require__.d(getter, 'a', getter);
    /******/         return getter;
    /******/     };
    /******/
    /******/     // Object.prototype.hasOwnProperty.call
    /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
    /******/
    /******/     // __webpack_public_path__
    /******/     __webpack_require__.p = "";
    /******/
    /******/     // Load entry module and return exports
    /******/     return __webpack_require__(__webpack_require__.s = 0);
    /******/ })
    /************************************************************************/
    /******/ ([
    /* 0 */
    /***/ (function(module, __webpack_exports__, __webpack_require__) {
    
    "use strict";
    Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
    /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__one_js__ = __webpack_require__(1);
    
    
    var num = 256;
    console.log(Object(__WEBPACK_IMPORTED_MODULE_0__one_js__["a" /* default */])(num));
    
    
    
    
    /***/ }),
    /* 1 */
    /***/ (function(module, __webpack_exports__, __webpack_require__) {
    
    "use strict";
    var add100 = function (a) {
        return a * 100;
    }
    
    /* harmony default export */ __webpack_exports__["a"] = (add100);
    
    /***/ })
    /******/ ]);

     打包命令:

    webpack 要打包的入口文件路径  打包好的文件的存储路径

  • 相关阅读:
    Hibernate操作指南-实体之间的关联关系(基于注解)
    Hibernate操作指南-实体与常用类型的映射以及基本的增删改查(基于注解)
    Hibernate操作指南-搭建一个简单的示例(基于Java Persistence API JPA)
    Hibernate操作指南-搭建一个简单的示例(基于原生API和注解)
    Hibernate操作指南-搭建一个简单的示例(基于原生API和XML)
    SpringSecurity——基于Spring、SpringMVC和MyBatis自定义SpringSecurity权限认证规则
    JUnit操作指南-批量执行单元测试(将多个测试类捆绑在一起执行)
    SpringSecurity操作指南-在SpringMVC项目上配置Spring Security
    SpringMVC——Servlet容器启动时初始化SpringMVC应用的原理
    SpringMVC操作指南-整合Spring、SpringMVC、MyBatis、Log4j/Log4j2及JUnit4搭建项目框架
  • 原文地址:https://www.cnblogs.com/carry-2017/p/11295490.html
Copyright © 2011-2022 走看看