UNPKG

3.12 kBMarkdownView Raw
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
14The `piral-instance-webpack-plugin` helps you to build Piral instances using Webpack.
15
16## Getting Started
17
18To begin, you'll need to install `piral-instance-webpack-plugin`:
19
20```console
21$ npm install piral-instance-webpack-plugin --save-dev
22```
23
24Then add the plugin to your `webpack` config. For example:
25
26**webpack.config.js**
27
28```js
29const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
30const piralPkg = require('./package.json');
31
32module.exports = {
33 plugins: [new PiralInstanceWebpackPlugin(piralPkg)],
34};
35```
36
37And run `webpack` via your preferred method.
38
39## Options
40
41### `variables`
42
43Allows supplying additional variables to be used as definitions. Similar to the `definePlugin`.
44
45Example:
46
47```js
48const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
49const piralPkg = require('./package.json');
50
51module.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
64Defines 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
66Example:
67
68```js
69const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
70const piralPkg = require('./package.json');
71
72module.exports = {
73 plugins: [
74 new PiralInstanceWebpackPlugin(piralPkg, {
75 debug: true,
76 }),
77 ],
78};
79```
80
81### `emulator`
82
83Defines 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
85Example:
86
87```js
88const { PiralInstanceWebpackPlugin } = require('piral-instance-webpack-plugin');
89const piralPkg = require('./package.json');
90
91module.exports = {
92 plugins: [
93 new PiralInstanceWebpackPlugin(piralPkg, {
94 emulator: '/$pilet-api',
95 }),
96 ],
97};
98```
99
100## Contributing
101
102Contributions in any form are appreciated and much welcome!
103
104Just 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
108This 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