UNPKG

2.07 kBMarkdownView Raw
1# rax-webpack-plugin [![npm](https://img.shields.io/npm/v/rax-webpack-plugin.svg)](https://www.npmjs.com/package/rax-webpack-plugin) [![Dependency Status](https://david-dm.org/alibaba/rax.svg?path=packages/rax-webpack-plugin)](https://david-dm.org/alibaba/rax.svg?path=packages/rax-webpack-plugin) [![Known Vulnerabilities](https://snyk.io/test/npm/rax-webpack-plugin/badge.svg)](https://snyk.io/test/npm/rax-webpack-plugin)
2
3> Webpack plugin for Rax framework.
4
5## Install
6
7```sh
8$ npm install --save-dev rax-webpack-plugin
9```
10
11## Usage
12
13```javascript
14var RaxPlugin = require('rax-webpack-plugin');
15
16module.exports = {
17 plugins: [
18 new RaxPlugin({
19 // Target format: `bundle`, `cmd`, `umd` or `factory`(build for builtin module format), default is umd
20 target: 'umd',
21 // Only for `bundle` target, default is '// {"framework" : "Rax"}'
22 frameworkComment: '// {"framework" : "Rax"}',
23 // component mode build config
24 moduleName: 'rax',
25 globalName: 'Rax',
26 // Enable external builtin modules, default is false
27 externalBuiltinModules: false,
28 // Config which builtin modules should external, default config is define in `RaxPlugin.BuiltinModules`
29 builtinModules: RaxPlugin.BuiltinModules,
30 // Enable include polyfill files
31 includePolyfills: false,
32 // Config which polyfill should include, defaut is empty
33 polyfillModules: [],
34 // Check duplicate dependencies, default is ['rax']
35 duplicateCheck: ['rax'],
36 })
37 ]
38}
39```
40
41### MultiplePlatform(<config:Object>[, options: Object])
42
43Output multiple platform
44
45#### options
46
47- `platforms` Array of ['web', 'node', 'weex', 'reactnative']
48- `exclude` Multiple platform loader exclude, default is `/(node_modules|bower_components)/`
49- `name` Default is `['universal-env']`, you can reassign to other module name when needed
50
51example
52
53```javascript
54const config = require('webpack.config.js');
55
56const multipleConfig = RaxPlugin.MultiplePlatform(config, {
57 platforms: ['web', 'weex']
58});
59
60const compiler = webpack(configs);
61
62// ....
63```