Skip to content

githoniel/weex-code-split-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weex-code-split-plugin

restore webpack code-split feature for weex, this plugin need you to give a fs read function and it will use new Function to run your splited code.

Install

npm install weex-code-split-plugin --save

Usage

add below to you webpack.config.js

const WeexCodeSplitPlugin = require('weex-code-split-plugin')

module.exports = {
    plugins: [
        new WeexCodeSplitPlugin({
            fsReadFunction:weexFSRead,
            publicPath: '/Share/ULightApp'
        })
  ]
}

Options

fsReadFunction(required, string/function): fs read function, do not use any es6 syntax for compatibility.

publicPath(optional, string): override webpack's public path for weexFSRead's base path.

DEV mode

if you wants to use this in dev mode running at real device. you need to rewrite the publicPath as below

const ip = require('ip').address()
const port = require('../port') // you port

weexConfig.plugins.forEach((item) => {
    if (item instanceof WeexCodeSplitPlugin) {
        item.options.publicPath = `http://${ip}:${port}/`
    }
})

About

restore webpack code-splite feature for weex

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published