1 | <div align="center">
|
2 | <a href="https://github.com/webpack/webpack">
|
3 | <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
|
4 | </a>
|
5 | </div>
|
6 |
|
7 | [![npm][npm]][npm-url]
|
8 | [![node][node]][node-url]
|
9 | [![chat][chat]][chat-url]
|
10 | [![size][size]][size-url]
|
11 |
|
12 | # piral-instance-webpack-plugin
|
13 |
|
14 | The `piral-instance-webpack-plugin` helps you to build Piral instances using Webpack.
|
15 |
|
16 | ## Getting Started
|
17 |
|
18 | To begin, you'll need to install `piral-instance-webpack-plugin`:
|
19 |
|
20 | ```console
|
21 | $ npm install piral-instance-webpack-plugin --save-dev
|
22 | ```
|
23 |
|
24 | Then add the plugin to your `webpack` config. For example:
|
25 |
|
26 | **webpack.config.js**
|
27 |
|
28 | ```js
|
29 | const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
|
30 | const piralPkg = require('./package.json');
|
31 |
|
32 | module.exports = {
|
33 | plugins: [new PiralInstanceWebpackPlugin(piralPkg)],
|
34 | };
|
35 | ```
|
36 |
|
37 | And run `webpack` via your preferred method.
|
38 |
|
39 | ## Options
|
40 |
|
41 | ### `variables`
|
42 |
|
43 | Allows supplying additional variables to be used as definitions. Similar to the `definePlugin`.
|
44 |
|
45 | Example:
|
46 |
|
47 | ```js
|
48 | const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
|
49 | const piralPkg = require('./package.json');
|
50 |
|
51 | module.exports = {
|
52 | plugins: [
|
53 | new PiralInstanceWebpackPlugin(piralPkg, {
|
54 | variables: {
|
55 | PIRAL_CLI_VERSION: require('piral-cli/package.json').version,
|
56 | },
|
57 | }),
|
58 | ],
|
59 | };
|
60 | ```
|
61 |
|
62 | ### `debug`
|
63 |
|
64 | Defines the version of the general debugging tools, if any. Setting `true` will auto-determine the version. Setting `false` or omitting will not include general debugging tools.
|
65 |
|
66 | Example:
|
67 |
|
68 | ```js
|
69 | const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
|
70 | const piralPkg = require('./package.json');
|
71 |
|
72 | module.exports = {
|
73 | plugins: [
|
74 | new PiralInstanceWebpackPlugin(piralPkg, {
|
75 | debug: true,
|
76 | }),
|
77 | ],
|
78 | };
|
79 | ```
|
80 |
|
81 | ### `emulator`
|
82 |
|
83 | Defines the path of the emulator pilet API, if any. Setting `true` will take the default path. Setting `false` or omitting will not include the emulator pilet API call.
|
84 |
|
85 | Example:
|
86 |
|
87 | ```js
|
88 | const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
|
89 | const piralPkg = require('./package.json');
|
90 |
|
91 | module.exports = {
|
92 | plugins: [
|
93 | new PiralInstanceWebpackPlugin(piralPkg, {
|
94 | emulator: '/$pilet-api',
|
95 | }),
|
96 | ],
|
97 | };
|
98 | ```
|
99 |
|
100 | ## Contributing
|
101 |
|
102 | Contributions in any form are appreciated and much welcome!
|
103 |
|
104 | Just make sure to post an issue or reach out to me on [Gitter](https://gitter.im/piral-io/community) before starting actual work on anything. It really helps to avoid problems.
|
105 |
|
106 | ## License
|
107 |
|
108 | This plugin is released using the MIT license.
|
109 |
|
110 | [npm]: https://img.shields.io/npm/v/piral-instance-webpack-plugin.svg
|
111 | [npm-url]: https://npmjs.com/package/piral-instance-webpack-plugin
|
112 | [node]: https://img.shields.io/node/v/piral-instance-webpack-plugin.svg
|
113 | [node-url]: https://nodejs.org
|
114 | [chat]: https://img.shields.io/badge/gitter-piral.io%2Fcommunity-brightgreen.svg
|
115 | [chat-url]: https://gitter.im/piral-io/community
|
116 | [size]: https://packagephobia.now.sh/badge?p=piral-instance-webpack-plugin
|
117 | [size-url]: https://packagephobia.now.sh/result?p=piral-instance-webpack-plugin
|