liuyuqi-dellpc 7 years ago
parent
commit
9196aa1aa2

+ 1 - 0
.gitignore

@@ -28,3 +28,4 @@ build/Release
 # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
 node_modules
 
+dist

+ 11 - 0
.vscode/launch.json

@@ -0,0 +1,11 @@
+{
+        "version": "0.2.0",
+        "configurations": [
+            {
+                "type": "node",
+                "request": "launch",
+                "name": "Launch Program",
+                "program": "${file}"
+            }
+        ]
+    }

+ 8 - 0
node/index.js

@@ -0,0 +1,8 @@
+var http = require('http');
+
+http.createServer(function (req, res) {
+  res.writeHead(200, { 'Content-Type': 'text/plain' });
+  res.end('hello node.js');
+}).listen(3000, 'localhost', function () {
+  console.log('Server running at http://localhost:3000');
+}); 

+ 19 - 0
node/package.json

@@ -0,0 +1,19 @@
+{
+  "name": "nodejs-note",
+  "version": "1.0.0",
+  "description": "nodejs笔记",
+  "main": "index.js",
+  "scripts": {
+    "test": "test"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://git.yoqi.me:3000/lyq/nodejs-note"
+  },
+  "keywords": [
+    "nodejs",
+    "笔记"
+  ],
+  "author": "liuyuqi.gov@msn.cn",
+  "license": "ISC"
+}

+ 7 - 0
webpack-demo1/README.md

@@ -0,0 +1,7 @@
+# webpackjs官方最简单demo
+1. 执行代码:
+```code
+cd /webpack
+webpack
+```
+2. dist/js会生成输出的js。

+ 3 - 0
webpack-demo1/app.js

@@ -0,0 +1,3 @@
+import bar from './bar';
+
+bar();

+ 3 - 0
webpack-demo1/bar.js

@@ -0,0 +1,3 @@
+export default function bar() {
+    //
+  }

+ 91 - 0
webpack-demo1/bundle.js

@@ -0,0 +1,91 @@
+/******/ (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;
+
+/******/ 	// identity function for calling harmony imports with the correct context
+/******/ 	__webpack_require__.i = function(value) { return value; };
+
+/******/ 	// 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 = 1);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (immutable) */ __webpack_exports__["a"] = bar;
+function bar() {
+    //
+  }
+
+/***/ }),
+/* 1 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__bar__ = __webpack_require__(0);
+
+
+__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__bar__["a" /* default */])();
+
+/***/ })
+/******/ ]);

+ 9 - 0
webpack-demo1/page.html

@@ -0,0 +1,9 @@
+<html>
+    <head>
+      ...
+    </head>
+    <body>
+      ...
+      <script src="bundle.js"></script>
+    </body>
+  </html>

+ 6 - 0
webpack-demo1/webpack.config.js

@@ -0,0 +1,6 @@
+module.exports = {
+  entry: './app.js',
+  output: {
+    filename: 'dist/js/bundle.js'
+  }
+};