nej-commonjs

0.5.2 • Public • Published

NEJ-CommonJS

NEJ 是网易开源的一体化前端框架,而 NEJ-CommonJS 是 NEJ 的 CommonJS 版本

如何开始

1. 下载安装到本地

cd /path/to/yourproject
$ npm i --save nej-commonjs

2. 配置 webpack

由于 NEJ-CommonJS 中在模块内使用了 this 变量,所以需要使用 imports-loader ,来修正 this 指向到 window

a. 安装 imports-loader

$ cnpm i --save-dev imports-loader

b. 配置 webpack.config.js

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

查看 example

LICENSE

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i nej-commonjs

Weekly Downloads

1

Version

0.5.2

License

MIT

Last publish

Collaborators

  • junesmith
  • syd2011