Skip to content

Commit eb14820

Browse files
committed
Node 引用模块测试
1 parent 1509654 commit eb14820

5 files changed

Lines changed: 55 additions & 0 deletions

File tree

require/.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"type": "node",
10+
"request": "launch",
11+
"name": "Launch Program",
12+
"program": "${workspaceFolder}/b.js"
13+
}
14+
]
15+
}

require/jsconfig.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
// "target": "es6",
4+
// "module": "commonjs",
5+
"baseUrl": "./",
6+
// "paths": {
7+
// "*": [
8+
// "*"
9+
// ]
10+
// }
11+
},
12+
"exclude": [
13+
"node_modules"
14+
]
15+
}

require/main/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let path = require('path')
2+
process.env.NODE_PATH = path.resolve(__dirname, '../') ;
3+
require('module').Module._initPaths();
4+
5+
let utils = require('ut')
6+
7+
console.log(utils.key)

require/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "require",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"directories": {
7+
"test": "test"
8+
},
9+
"scripts": {
10+
"test": "echo \"Error: no test specified\" && exit 1"
11+
},
12+
"author": "",
13+
"license": "ISC"
14+
}

require/utils/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
module.exports = {
3+
key:' value'
4+
}

0 commit comments

Comments
 (0)