首页 > Web开发 > 详细

nodejs 2017

时间:2017-03-22 00:52:33      阅读:177      评论:0      收藏:0      [点我收藏+]

a.js

// 运行  node a.js

var path = require(‘path‘);
console.log(path.resolve()); // 不传参,会返回当前文件的绝对路径 
console.log(__dirname);  // 也是当前文件的绝对路径

console.log(path.resolve(__dirname));
console.log(path.resolve(__dirname,‘../dist/index.html‘)); 
// 路径组合成一个绝对路径  


var b = require(‘./b‘);
console.log(‘b.env: ‘ + b.build.env)
console.log(‘b.index: ‘ + b.build.index)

b.js

var path = require(‘path‘)
module.exports = {
    build:{
        index: path.resolve(__dirname,‘../dist/index.html‘),
        env: ‘testOne‘
    }
}

 

nodejs 2017

原文:http://www.cnblogs.com/gyz418/p/6597274.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!