$ npm install weex-rax-framework
const webpack = require('webpack');
const RaxPlugin = require('rax-webpack-plugin');
module.exports = {
target: 'node',
entry: {
// Entry name should ends with `.factory`
'your-module.factory' : './src/index.js',
},
output: {
path: './dist/',
filename: '[name].js',
},
plugins: [
new RaxPlugin({
// Your could config builtinModules here
externalBuiltinModules: false,
builtinModules: RaxPlugin.BuiltinModules,
});
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['es2015', 'rax']
}
}]
}
}
Then publish module with factory build file to npm registry:
npm publish
Or link module in local:
npm link
builtin.js in framework sourceInstall builtin module from npm:
npm install your-module --save
Or link from local:
npm link your-module
Config builtin.js and add your custom builtin module:
export let ModuleFactories = {
'rax': require('rax/dist/rax.factory'),
// Add your builtin module
'your-module': require('your-module/dist/your-module.factory'),
};
const webpack = require('webpack');
const RaxPlugin = require('rax-webpack-plugin');
module.exports = {
target: 'node',
entry: {
// Entry name should ends with `.framework`
'rax.framework': './packages/weex-rax-framework/src/index.js',
},
output: {
path: './packages/weex-rax-framework/dist/',
filename: '[name].js',
},
plugins: [
new RaxPlugin();
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['es2015']
}
}]
}
}
jsfm including weex-rax-framework?git clone git@github.com:alibaba/weex.git
cd weex
npm install
weex-rax-frameworknpm install weex-rax-framework
Or
npm link weex-rax-framework
weex-rax-frameworkUpdate html5/frameworks/index.js file with below content:
import * as Weex from './legacy/index'
import Rax from 'weex-rax-framework'
export default {
Rax,
Weex
}
jsfm for native renderer to dist/native.jsnpm run build:native
dist/native.js to weex-sdkcp -vf ./dist/native.js ./android/sdk/assets/main.js
cp -vf ./dist/native.js ./ios/sdk/WeexSDK/Resources/main.js
© 2010 - cnpmjs.org x YWFE | Home | YWFE