Skip to content

easy-team/easywebpack-weex

Repository files navigation

easywebpack-weex

NPM version build status Test coverage David deps Known Vulnerabilities npm download

基于 easywebpack 的 Weex Native 和 Weex Web 打包构建解决方案.

安装

$ npm i easywebpack-weex --save-dev

使用

const weex = require('easywebpack-weex');
// 获取 webpack weex 配置
const webpackConfig = weex.getWeexWebpackConfig({
  env: process.env.BUILD_ENV, // 支持 dev,test,local 模式
  entry: {
    index: 'src/app.js'
  }
});

// 获取 webpack web 配置
const webpackConfig = weex.getWebWebpackConfig({
  entry: {
    index: 'src/app.js'
  }
});

//  获取 webpack weex 和 web 配置
const webpackConfig = weex.getWebpackConfig({
  entry: {
    index: 'src/app.js'
  }
});

开发构建

  • 使用 webpack-cli 开发构建服务
webpack --config webpack.config.js
  • 使用 easywebpack 内置开发构建服务
const weex = require('easywebpack-weex');
if (process.env.NODE_ENV === 'development') {
  // development mode: webpack building and start webpack hot server
  weex.server(webpackConfig);
} else {
  // build file to disk
  weex.build(webpackConfig);
}

工程骨架

easywebpack-weex-boilerplate Weex构建项目骨架

webpack-weex-compile

webpack-weex-debug

License

MIT