@@ -44,6 +44,16 @@ Add the following line near the top of the file:
44
44
const mf_config = require (" @patternslib/dev/webpack/webpack.mf" );
45
45
```
46
46
47
+ Import all the dependencies you want to share.
48
+ Potentially these are the ones from Patternslib, Mockup and your own dependencies.
49
+ You can just add the Patternslib and Mockup dependencies, even if you are not using them.
50
+
51
+ ``` js
52
+ const package_json = require (" ./package.json" );
53
+ const package_json_mockup = require (" @plone/mockup/package.json" );
54
+ const package_json_patternslib = require (" @patternslib/patternslib/package.json" );
55
+ ```
56
+
47
57
Then find the following line:
48
58
49
59
``` js
@@ -55,17 +65,29 @@ Below this line add the following:
55
65
``` js
56
66
config .plugins .push (
57
67
mf_config ({
68
+ name: " myaddon" ,
58
69
filename: " myaddon-remote.min.js" ,
59
- package_json: package_json,
60
70
remote_entry: config .entry [" myaddon.min" ],
71
+ dependencies: {
72
+ ... package_json_patternslib .dependencies ,
73
+ ... package_json_mockup .dependencies ,
74
+ ... package_json .dependencies ,
75
+ },
61
76
})
62
77
);
63
78
```
64
79
65
- Replace ` myaddon-remote.min.js ` with the file name you want to use for your remote bundle.
66
- Replace ` myaddon.min ` with the corresponding key in ` config.entry ` that points to your ` index.js ` .
80
+ Replace the name ` myaddon ` with your addon bundle's name (any unique name will do...),
81
+ replace the filename ` myaddon-remote.min.js ` with the file name you want to use for your remote bundle,
82
+ and replace ` myaddon.min ` with the corresponding key in ` config.entry ` that points to your ` index.js ` .
83
+
84
+ For a full but simple example, see the Patterns generator [ pat-PATTERN-TEMPLATE] [ 2 ] or any other Pattern addon in the patternslib GitHub organisation.
85
+ For a complex example with Mockup integration see [ plone.app.mosaic] [ 3 ] and [ Mockup] [ 4 ] itself.
67
86
68
87
[ 1 ] : https://pypi.org/project/plonecli/
88
+ [ 2 ] : https://github.com/Patternslib/pat-PATTERN_TEMPLATE/blob/master/webpack.config.js
89
+ [ 3 ] : https://github.com/plone/plone.app.mosaic/blob/master/webpack.config.js
90
+ [ 4 ] : https://github.com/plone/mockup/blob/master/webpack.config.js
69
91
70
92
## Special case: global modules ` jQuery ` and ` Bootstrap `
71
93
0 commit comments