@maccesar/titools 3.3.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -61
- package/lib/cleanup.js +29 -0
- package/lib/commands/agents.js +8 -7
- package/lib/commands/skills.js +118 -23
- package/lib/config.js +13 -15
- package/lib/installer.js +5 -3
- package/lib/utils.js +36 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +188 -0
- package/skills/alloy-guides/references/CLI_TASKS.md +233 -0
- package/skills/alloy-guides/references/CONCEPTS.md +171 -0
- package/skills/alloy-guides/references/CONTROLLERS.md +279 -0
- package/skills/alloy-guides/references/MODELS.md +742 -0
- package/skills/alloy-guides/references/MODELS_ADVANCED.md +482 -0
- package/skills/alloy-guides/references/PURGETSS.md +57 -0
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +235 -0
- package/skills/alloy-guides/references/VIEWS_STYLES.md +375 -0
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +102 -0
- package/skills/alloy-guides/references/VIEWS_XML.md +581 -0
- package/skills/alloy-guides/references/WIDGETS.md +160 -0
- package/skills/alloy-howtos/SKILL.md +179 -0
- package/skills/alloy-howtos/references/best_practices.md +121 -0
- package/skills/alloy-howtos/references/cli_reference.md +230 -0
- package/skills/alloy-howtos/references/config_files.md +158 -0
- package/skills/alloy-howtos/references/custom_tags.md +148 -0
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +78 -0
- package/skills/alloy-howtos/references/samples.md +156 -0
- package/skills/purgetss/SKILL.md +6 -3
- package/skills/purgetss/references/EXAMPLES.md +8 -6
- package/skills/purgetss/references/app-branding.md +5 -0
- package/skills/purgetss/references/apply-directive.md +1 -1
- package/skills/purgetss/references/class-categories.md +1 -1
- package/skills/purgetss/references/class-index-properties.md +618 -0
- package/skills/purgetss/references/class-index.md +4 -610
- package/skills/purgetss/references/cli-commands.md +15 -0
- package/skills/purgetss/references/custom-fonts.md +39 -36
- package/skills/purgetss/references/custom-rules.md +1 -1
- package/skills/purgetss/references/customization-deep-dive.md +64 -1
- package/skills/purgetss/references/icon-fonts.md +2 -0
- package/skills/purgetss/references/migration-guide.md +53 -1
- package/skills/purgetss/references/multi-density-images.md +53 -2
- package/skills/purgetss/references/svg-pipeline.md +249 -0
- package/skills/purgetss/references/tikit-components.md +2 -2
- package/skills/purgetss/references/titanium-resets.md +2 -2
- package/skills/purgetss/references/ui-ux-design.md +7 -5
- package/skills/purgetss/references/version-history.md +12 -0
- package/skills/ti-api/SKILL.md +128 -0
- package/skills/ti-api/references/api-android.md +675 -0
- package/skills/ti-api/references/api-app-platform.md +636 -0
- package/skills/ti-api/references/api-core.md +764 -0
- package/skills/ti-api/references/api-data-network.md +641 -0
- package/skills/ti-api/references/api-media.md +655 -0
- package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
- package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
- package/skills/ti-api/references/api-modules-map.md +632 -0
- package/skills/ti-api/references/api-modules-nfc.md +725 -0
- package/skills/ti-api/references/api-modules-social-misc.md +526 -0
- package/skills/ti-api/references/api-services.md +700 -0
- package/skills/ti-api/references/api-ui-android.md +499 -0
- package/skills/ti-api/references/api-ui-extras.md +702 -0
- package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
- package/skills/ti-api/references/api-ui-ios.md +756 -0
- package/skills/ti-api/references/api-ui-lists.md +581 -0
- package/skills/ti-api/references/api-ui-text-input.md +607 -0
- package/skills/ti-api/references/api-ui-views.md +572 -0
- package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
- package/skills/ti-api/references/api-xml-global.md +743 -0
- package/skills/ti-guides/SKILL.md +82 -0
- package/skills/ti-guides/references/advanced-data-and-images.md +155 -0
- package/skills/ti-guides/references/android-manifest.md +97 -0
- package/skills/ti-guides/references/app-distribution.md +373 -0
- package/skills/ti-guides/references/application-frameworks.md +366 -0
- package/skills/ti-guides/references/cli-reference.md +700 -0
- package/skills/ti-guides/references/coding-best-practices.md +150 -0
- package/skills/ti-guides/references/commonjs-advanced.md +279 -0
- package/skills/ti-guides/references/hello-world.md +99 -0
- package/skills/ti-guides/references/hyperloop-native-access.md +458 -0
- package/skills/ti-guides/references/javascript-primer.md +402 -0
- package/skills/ti-guides/references/reserved-words.md +36 -0
- package/skills/ti-guides/references/resources.md +172 -0
- package/skills/ti-guides/references/style-and-conventions.md +104 -0
- package/skills/ti-guides/references/tiapp-config.md +655 -0
- package/skills/ti-howtos/SKILL.md +131 -0
- package/skills/ti-howtos/references/android-platform-deep-dives.md +609 -0
- package/skills/ti-howtos/references/automation-fastlane-appium.md +96 -0
- package/skills/ti-howtos/references/buffer-codec-streams.md +162 -0
- package/skills/ti-howtos/references/cross-platform-development.md +358 -0
- package/skills/ti-howtos/references/debugging-profiling.md +473 -0
- package/skills/ti-howtos/references/extending-titanium.md +684 -0
- package/skills/ti-howtos/references/google-maps-v2.md +172 -0
- package/skills/ti-howtos/references/ios-map-kit.md +149 -0
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +595 -0
- package/skills/ti-howtos/references/local-data-sources.md +310 -0
- package/skills/ti-howtos/references/location-and-maps.md +267 -0
- package/skills/ti-howtos/references/media-apis.md +268 -0
- package/skills/ti-howtos/references/notification-services.md +539 -0
- package/skills/ti-howtos/references/remote-data-sources.md +339 -0
- package/skills/ti-howtos/references/tutorials.md +552 -0
- package/skills/ti-howtos/references/using-modules.md +182 -0
- package/skills/ti-howtos/references/web-content-integration.md +288 -0
- package/skills/ti-howtos/references/webpack-build-pipeline.md +125 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# Web content integration
|
|
2
|
+
|
|
3
|
+
## 1. The WebView component
|
|
4
|
+
|
|
5
|
+
### WKWebView (Titanium SDK 8.0.0+)
|
|
6
|
+
As of Titanium SDK 8.0.0, WKWebView is the only supported web view on iOS. UIWebView was deprecated and removed. WKWebView behaves differently, so plan for that.
|
|
7
|
+
|
|
8
|
+
### Basic WebView creation
|
|
9
|
+
|
|
10
|
+
Remote URL:
|
|
11
|
+
```javascript
|
|
12
|
+
const webview = Ti.UI.createWebView({
|
|
13
|
+
url: 'https://titaniumsdk.com'
|
|
14
|
+
});
|
|
15
|
+
win.add(webview);
|
|
16
|
+
win.open();
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Local HTML:
|
|
20
|
+
```javascript
|
|
21
|
+
const webview = Ti.UI.createWebView({
|
|
22
|
+
url: 'local.html' // Relative to Resources or app/assets/app/lib
|
|
23
|
+
});
|
|
24
|
+
win.add(webview);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Inline HTML:
|
|
28
|
+
```javascript
|
|
29
|
+
const webview = Ti.UI.createWebView({
|
|
30
|
+
html: '<html><body><h1>Hello</h1></body></html>'
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Local web content with assets
|
|
35
|
+
Local content can include CSS, JS, and images. Paths are relative to Resources (Classic) or app/assets/app/lib (Alloy).
|
|
36
|
+
|
|
37
|
+
`local.html`:
|
|
38
|
+
```html
|
|
39
|
+
<html>
|
|
40
|
+
<head>
|
|
41
|
+
<link rel="stylesheet" type="text/css" href="local.css"/>
|
|
42
|
+
<script src="local.js"></script>
|
|
43
|
+
</head>
|
|
44
|
+
<body>
|
|
45
|
+
<p>Local content</p>
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### WebView properties and methods
|
|
51
|
+
|
|
52
|
+
Navigation:
|
|
53
|
+
- `canGoBack()` - returns true if possible to go back
|
|
54
|
+
- `canGoForward()` - returns true if possible to go forward
|
|
55
|
+
- `goBack()` - navigate back in history
|
|
56
|
+
- `goForward()` - navigate forward in history
|
|
57
|
+
|
|
58
|
+
Load control:
|
|
59
|
+
- `loading` (Boolean) - current loading state
|
|
60
|
+
- `reload()` - refresh the page
|
|
61
|
+
- `stopLoading()` - stop loading
|
|
62
|
+
- `repaint()` - force repaint
|
|
63
|
+
|
|
64
|
+
Data handling:
|
|
65
|
+
- `url` - local or remote URL
|
|
66
|
+
- `html` - inline HTML string
|
|
67
|
+
- `scalesPageToFit` - scale content to dimensions
|
|
68
|
+
- `setBasicAuthentication(host, username, password)` - HTTP auth
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
webView.setBasicAuthentication('myDomain.com', 'username', 'password');
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Events:
|
|
75
|
+
- `beforeload` - fires before loading begins (`e.url` contains the source)
|
|
76
|
+
- `load` - fires when content has loaded
|
|
77
|
+
- `error` - fires on load failures (`e.url`, `e.message`)
|
|
78
|
+
|
|
79
|
+
## 2. Communication between WebViews and Titanium
|
|
80
|
+
|
|
81
|
+
### Local web content communication
|
|
82
|
+
|
|
83
|
+
Logging from WebView:
|
|
84
|
+
Ti.API methods work inside local HTML.
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<html>
|
|
88
|
+
<body onload="Ti.API.info('Page loaded!');">
|
|
89
|
+
<p>Logging works!</p>
|
|
90
|
+
</body>
|
|
91
|
+
</html>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Bidirectional events with `Ti.App`:
|
|
95
|
+
|
|
96
|
+
In local HTML:
|
|
97
|
+
```html
|
|
98
|
+
<html>
|
|
99
|
+
<head>
|
|
100
|
+
<script>
|
|
101
|
+
// Listen for events from Titanium
|
|
102
|
+
Ti.App.addEventListener('app:fromTitanium', (e) => {
|
|
103
|
+
alert(e.message);
|
|
104
|
+
document.getElementById('output').textContent = e.message;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Send event to Titanium
|
|
108
|
+
function sendToApp() {
|
|
109
|
+
Ti.App.fireEvent('app:fromWebView', {
|
|
110
|
+
message: 'Hello from WebView!'
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
114
|
+
</head>
|
|
115
|
+
<body>
|
|
116
|
+
<button onclick="sendToApp()">Send to Titanium</button>
|
|
117
|
+
<div id="output"></div>
|
|
118
|
+
</body>
|
|
119
|
+
</html>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
In Titanium:
|
|
123
|
+
```javascript
|
|
124
|
+
const webview = Ti.UI.createWebView({ url: 'local.html' });
|
|
125
|
+
|
|
126
|
+
// Listen for events from the WebView
|
|
127
|
+
Ti.App.addEventListener('app:fromWebView', (e) => {
|
|
128
|
+
alert(e.message);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Send event to the WebView
|
|
132
|
+
const button = Ti.UI.createButton({
|
|
133
|
+
title: 'Send to WebView'
|
|
134
|
+
});
|
|
135
|
+
button.addEventListener('click', () => {
|
|
136
|
+
Ti.App.fireEvent('app:fromTitanium', {
|
|
137
|
+
message: 'Hello from Titanium!'
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Remote web content communication
|
|
143
|
+
|
|
144
|
+
Titanium statements (`Ti.API`, `Ti.App`) do not work in remote HTML content.
|
|
145
|
+
|
|
146
|
+
Warning: On iOS 12.0+, calling `evalJS()` synchronously from some contexts can deadlock. Prefer the async version with a callback.
|
|
147
|
+
|
|
148
|
+
#### Using `evalJS()` for remote content
|
|
149
|
+
Inject JavaScript and retrieve results as strings:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
const webview = Ti.UI.createWebView({ url: 'https://example.com' });
|
|
153
|
+
|
|
154
|
+
webview.addEventListener('load', (e) => {
|
|
155
|
+
// Get the page title
|
|
156
|
+
const title = webview.evalJS('document.title');
|
|
157
|
+
Ti.API.info(`Page title: ${title}`);
|
|
158
|
+
|
|
159
|
+
// Get cookies
|
|
160
|
+
const cookies = webview.evalJS('document.cookie');
|
|
161
|
+
Ti.API.info(`Cookies: ${cookies}`);
|
|
162
|
+
|
|
163
|
+
// Execute a custom function
|
|
164
|
+
webview.evalJS('alert("Hello from Titanium!");');
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`evalJS()` rules:
|
|
169
|
+
- Call it from the `load` event (page must be loaded)
|
|
170
|
+
- Pass code as a single string
|
|
171
|
+
- Returns a string (or null)
|
|
172
|
+
- Use `JSON.stringify()` for complex data
|
|
173
|
+
|
|
174
|
+
#### Passing data to remote content
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
webview.addEventListener('load', () => {
|
|
178
|
+
const data = { user: 'John', score: 100 };
|
|
179
|
+
webview.evalJS(`window.appData = ${JSON.stringify(data)};`);
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Then in remote HTML:
|
|
184
|
+
```html
|
|
185
|
+
<script>
|
|
186
|
+
console.log(window.appData.user); // 'John'
|
|
187
|
+
</script>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 3. Performance and interaction concerns
|
|
191
|
+
|
|
192
|
+
### WebView performance
|
|
193
|
+
WebView consumes significant resources:
|
|
194
|
+
- Each WebView has its own rendering context
|
|
195
|
+
- Memory overhead is high
|
|
196
|
+
- Load time is independent of content complexity
|
|
197
|
+
|
|
198
|
+
Best practice: if you can recreate the content with native Titanium components, do it.
|
|
199
|
+
|
|
200
|
+
### WebView in TableViews
|
|
201
|
+
Anti-pattern: embedding WebViews in TableViewRows causes slow scrolling.
|
|
202
|
+
|
|
203
|
+
### WebView in scrollable components
|
|
204
|
+
WebViews do not behave well inside other scrollable containers (ScrollView, TableView). They consume touch events.
|
|
205
|
+
|
|
206
|
+
Workaround: set `touchEnabled: false` on the WebView if it sits inside a scrollable parent:
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
const webview = Ti.UI.createWebView({
|
|
210
|
+
url: 'content.html',
|
|
211
|
+
touchEnabled: false // Allow parent to handle touches
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Viewport meta tag
|
|
216
|
+
For mobile-optimized content, use the viewport meta tag:
|
|
217
|
+
|
|
218
|
+
```html
|
|
219
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## 4. WebView use cases
|
|
223
|
+
|
|
224
|
+
Common WebView use cases:
|
|
225
|
+
- HTML forms: auto-scroll to focused fields, next/previous navigation, native keyboard integration
|
|
226
|
+
- Rich text or HTML email: render styled content that is hard to replicate with native labels
|
|
227
|
+
- Canvas/graphics: HTML5 Canvas provides 2D drawing not available in native Titanium APIs
|
|
228
|
+
- OAuth flows: load third-party auth pages in a WebView and intercept redirects
|
|
229
|
+
|
|
230
|
+
### Authentication flows
|
|
231
|
+
Many OAuth providers use WebView for login (for example, the Facebook module).
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
const authWebView = Ti.UI.createWebView({
|
|
235
|
+
url: 'https://auth.example.com/oauth'
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
authWebView.addEventListener('load', (e) => {
|
|
239
|
+
// Detect redirect to callback URL with token
|
|
240
|
+
if (e.url.indexOf('myapp://callback') === 0) {
|
|
241
|
+
const token = extractTokenFromUrl(e.url);
|
|
242
|
+
Ti.App.fireEvent('auth:success', { token: token });
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Canvas and graphics
|
|
248
|
+
For complex graphics, use HTML5 Canvas:
|
|
249
|
+
|
|
250
|
+
`local.html`:
|
|
251
|
+
```html
|
|
252
|
+
<canvas id="myCanvas" width="300" height="200"></canvas>
|
|
253
|
+
<script>
|
|
254
|
+
const ctx = document.getElementById('myCanvas').getContext('2d');
|
|
255
|
+
ctx.fillStyle = 'green';
|
|
256
|
+
ctx.fillRect(10, 10, 150, 100);
|
|
257
|
+
</script>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## 5. WKWebView behavioral differences (iOS)
|
|
261
|
+
|
|
262
|
+
- Cookies: WKWebView uses a separate cookie store from `Ti.Network`. Cookies set via HTTPClient are not shared with WebViews.
|
|
263
|
+
- `localStorage`/`sessionStorage`: not shared between the native app and the WebView. Each WKWebView has its own storage.
|
|
264
|
+
- `evalJS` is async: on iOS 12.0+, synchronous `evalJS()` can deadlock. Use the callback form instead:
|
|
265
|
+
|
|
266
|
+
```javascript
|
|
267
|
+
webView.evalJS('document.title', (result) => {
|
|
268
|
+
Ti.API.info(`Title: ${result}`);
|
|
269
|
+
});
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
- Viewport meta tag required: WKWebView needs an explicit viewport tag to scale content correctly:
|
|
273
|
+
|
|
274
|
+
```html
|
|
275
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
- Custom fonts: use a special `@font-face` path format in WKWebView CSS. Fonts must be in the app bundle and referenced correctly.
|
|
279
|
+
- Remote HTML limitations: `Ti.API`, `Ti.App.fireEvent()`, and other Titanium calls do not work in remotely-loaded HTML. Only local HTML can communicate with the Titanium runtime.
|
|
280
|
+
|
|
281
|
+
## Best practices summary
|
|
282
|
+
|
|
283
|
+
1. Avoid WebViews when possible. Use native components.
|
|
284
|
+
2. Never embed a WebView in a TableView.
|
|
285
|
+
3. Use local content for integration. Only local content supports `Ti.App` events.
|
|
286
|
+
4. Use `evalJS()` for remote content. It is the only way to interact with remote pages.
|
|
287
|
+
5. Wait for the `load` event before calling `evalJS()`.
|
|
288
|
+
6. Configure the viewport for proper mobile rendering.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Webpack build pipeline
|
|
2
|
+
|
|
3
|
+
> **⚠️ Appcelerator/Axway era feature**
|
|
4
|
+
> The Webpack pipeline documented here was introduced with Titanium SDK 9.1.0 as part of the Axway AMPLIFY toolchain (`appcd` daemon). Since Axway discontinued Appcelerator, this feature is **not maintained** in the current TiDev CLI (`ti`). If you are using the community TiDev CLI, this pipeline may not be available. Prefer the standard `ti build` pipeline unless your project already uses Webpack.
|
|
5
|
+
|
|
6
|
+
Webpack integration is an alternative build pipeline starting with Titanium SDK 9.1.0. It is optional. When enabled, Webpack manages asset and code bundling.
|
|
7
|
+
|
|
8
|
+
## 1. Key benefits
|
|
9
|
+
- Fast incremental builds: only changed files are processed.
|
|
10
|
+
- npm support: install packages in the root and import them directly.
|
|
11
|
+
- Build-time resolution: `require` calls are resolved during compilation, not at runtime.
|
|
12
|
+
|
|
13
|
+
## 2. The `@` alias
|
|
14
|
+
Webpack adds the `@` alias to reference the source root without deep relative paths.
|
|
15
|
+
|
|
16
|
+
| Project type | Path mapped by `@` |
|
|
17
|
+
| :----------- | :----------------- |
|
|
18
|
+
| Alloy | `app/lib` |
|
|
19
|
+
| Classic | `src` |
|
|
20
|
+
|
|
21
|
+
Usage example:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
// Before (without webpack)
|
|
25
|
+
import Utils from '../../utils/helper';
|
|
26
|
+
|
|
27
|
+
// Now (with webpack)
|
|
28
|
+
import Utils from '@/utils/helper';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 3. npm dependency management
|
|
32
|
+
Install a package in the project root:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install lodash
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Use it in Titanium code:
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import _ from 'lodash';
|
|
42
|
+
const data = _.chunk(['a', 'b', 'c', 'd'], 2);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 4. Platform-specific files
|
|
46
|
+
Webpack detects platform-specific files using the `filename.<platform>.js` pattern.
|
|
47
|
+
|
|
48
|
+
Example:
|
|
49
|
+
- `utils.js` (common)
|
|
50
|
+
- `utils.ios.js` (iOS only)
|
|
51
|
+
- `utils.android.js` (Android only)
|
|
52
|
+
|
|
53
|
+
When you `import { func } from '@/utils'`, Webpack picks the correct version for the build target.
|
|
54
|
+
|
|
55
|
+
## 5. Diagnostic web UI
|
|
56
|
+
Webpack includes a web interface to analyze builds and asset sizes.
|
|
57
|
+
Default URL: `http://localhost:1732/webpack/latest/web`
|
|
58
|
+
|
|
59
|
+
## 6. Project plugins
|
|
60
|
+
Webpack support is powered by plugins chosen based on project type:
|
|
61
|
+
|
|
62
|
+
| Plugin | Purpose |
|
|
63
|
+
| ---------------------------------- | ----------------------- |
|
|
64
|
+
| `@appcd/webpack-plugin-alloy` | Alloy project support |
|
|
65
|
+
| `@appcd/webpack-plugin-classic` | Classic project support |
|
|
66
|
+
| `@appcd/webpack-plugin-babel` | Babel transpilation |
|
|
67
|
+
| `@appcd/webpack-plugin-typescript` | TypeScript support |
|
|
68
|
+
|
|
69
|
+
### Custom plugin configuration
|
|
70
|
+
Customize with the `webpack-chain` API in `webpack.config.js`:
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
module.exports = (api) => {
|
|
74
|
+
// Add a custom alias
|
|
75
|
+
api.chainWebpack((config) => {
|
|
76
|
+
config.resolve.alias.set('@utils', api.resolve('app/lib/utils'));
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Common customizations:
|
|
82
|
+
- Add alias: `config.resolve.alias.set(name, path)`
|
|
83
|
+
- Add loader: `config.module.rule(name).use(name).loader(loader)`
|
|
84
|
+
- Delete plugin: `config.plugins.delete(name)`
|
|
85
|
+
|
|
86
|
+
## 7. Advanced configuration
|
|
87
|
+
Extend configuration via plugins in `package.json`:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"appcdWebpackPlugins": [
|
|
92
|
+
"my-local-plugin.js"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 8. Global configuration
|
|
98
|
+
Configure Webpack daemon settings in `~/.appcelerator/appcd/config.json`:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"webpack": {
|
|
103
|
+
"inactivityTimeout": 600000
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 9. Troubleshooting
|
|
109
|
+
|
|
110
|
+
Build seems stuck: the Webpack daemon may need a restart.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
appcd exec /webpack/latest/stop
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
View build logs:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
appcd logcat "*webpack*"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 10. Known limitations
|
|
123
|
+
- Hyperloop is not compatible with the Webpack pipeline.
|
|
124
|
+
- Alloy.jmk build hooks are not supported. Use Webpack plugins instead.
|
|
125
|
+
- The first build may be slower due to daemon startup.
|