Skip to content

kaola-fed/nej.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nej.js

nej 是网易开源的前端代码库,nej.js 是 nej 的 cjs 版本

如何开始

1. 下载安装到本地

$ cd /path/to/yourproject
$ npm i --save nej.js

2. 配置 webpack

由于 nej.js 中在模块内使用了 this 变量表示 window ,所以使用时需要 imports-loader

a. 安装 imports-loader

$ cnpm i --save-dev imports-loader

b. 配置 webpack.config.js

const webpack = require('webpack')
module.exports = {
    module: {
        loaders: [{
            test: /nej.js/,
            loader: "imports-loader?this=>window"
        }]
    },
    plugins: [
        new webpack.DefinePlugin({
            DEBUG: JSON.stringify(false), // 是否为 debug 模式
            CMPT: JSON.stringify(true)    // 是否开启兼容模式,即 `NEJ.C('xxx')`
        })
    ],
}

查看 example

LICENSE

MIT

Releases

No releases published

Packages

No packages published

Languages