This commit is contained in:
3056762376@qq.com 2022-11-19 12:21:29 +08:00
parent 68a32dcbeb
commit c2307aaeb8
6 changed files with 215 additions and 0 deletions

View File

@ -0,0 +1,134 @@
/******/ (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__calc__ = __webpack_require__(1);
let n1=prompt("请输入第一个值")
let n2=prompt("请输入第二个值")
let r=prompt("请输入半径")
console.log(`这是两数进行相加的结果${__WEBPACK_IMPORTED_MODULE_0__calc__["b" /* add */](n1, n2) }`);
console.log(`这是两数进行相减的结果${__WEBPACK_IMPORTED_MODULE_0__calc__["g" /* sub */](n1, n2)}`);
console.log(`这是两数进行相乘的结果${__WEBPACK_IMPORTED_MODULE_0__calc__["d" /* mult */](n1, n2)}`);
console.log(`这是两数进行相除的结果${__WEBPACK_IMPORTED_MODULE_0__calc__["c" /* divi */](n1, n2)}`);
console.log(`这是两数进行求余的结果${__WEBPACK_IMPORTED_MODULE_0__calc__["f" /* rem */](n1, n2)}`);
console.log(`这是长方形/正方形的面积${__WEBPACK_IMPORTED_MODULE_0__calc__["e" /* rect_area */](n1, n2)}`);
console.log(`这是圆的面积${__WEBPACK_IMPORTED_MODULE_0__calc__["a" /* Area_of_circle */](r)}`);
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return add; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return sub; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return mult; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return divi; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return rem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return rect_area; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Area_of_circle; });
function add(n1,n2){
return n1+n2;
}
function sub(n1,n2){
return n1-n2;
}
function mult(n1,n2){
return n1*n2
}
function divi(n1,n2){
let t=0
if(n1<n2){
t=n2;n2=n1;n1=t
}
return n1/n2
}
function rem(n1,n2){
let t = 0
if (n1 < n2) {
t = n2; n2 = n1; n1 = t
}
return n1 % n2
}
function rect_area(n1,n2){
if(n1==n2){
return n1*n1
}else{
return n1*n2
}
}
const pi=3.14
function Area_of_circle(r){
return pi*r*r
}
/***/ })
/******/ ]);

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script src="./dist/result.js"></script>
</html>

View File

@ -0,0 +1,12 @@
{
"name": "webpack_study",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"serve":"webpack"
},
"author": "",
"license": "ISC"
}

View File

@ -0,0 +1,37 @@
function add(n1,n2){
return n1+n2;
}
function sub(n1,n2){
return n1-n2;
}
function mult(n1,n2){
return n1*n2
}
function divi(n1,n2){
let t=0
if(n1<n2){
t=n2;n2=n1;n1=t
}
return n1/n2
}
function rem(n1,n2){
let t = 0
if (n1 < n2) {
t = n2; n2 = n1; n1 = t
}
return n1 % n2
}
function rect_area(n1,n2){
if(n1==n2){
return n1*n1
}else{
return n1*n2
}
}
const pi=3.14
function Area_of_circle(r){
return pi*r*r
}
export{
add, sub, mult, divi, rem, rect_area, Area_of_circle
}

View File

@ -0,0 +1,11 @@
import * as calc from "./calc";
let n1=prompt("请输入第一个值")
let n2=prompt("请输入第二个值")
let r=prompt("请输入半径")
console.log(`这是两数进行相加的结果${calc.add(n1, n2) }`);
console.log(`这是两数进行相减的结果${calc.sub(n1, n2)}`);
console.log(`这是两数进行相乘的结果${calc.mult(n1, n2)}`);
console.log(`这是两数进行相除的结果${calc.divi(n1, n2)}`);
console.log(`这是两数进行求余的结果${calc.rem(n1, n2)}`);
console.log(`这是长方形/正方形的面积${calc.rect_area(n1, n2)}`);
console.log(`这是圆的面积${calc.Area_of_circle(r)}`);

View File

@ -0,0 +1,8 @@
const path=require("path")
module.exports={
entry:"./src/index.js",
output:{
path:path.resolve(__dirname,"dist"),
filename:"result.js"
}
}