|
| 1 | +import Tabs from '@theme/Tabs'; |
| 2 | +import TabItem from '@theme/TabItem'; |
| 3 | + |
1 | 4 | # Build Options
|
2 | 5 |
|
3 | 6 | Developers have two options for using Ionic components: Standalone or Modules. This guide covers both options as well as the benefits and downsides of each approach.
|
@@ -28,7 +31,7 @@ See the [Standalone Migration Guide](#migrating-from-modules-to-standalone) for
|
28 | 31 |
|
29 | 32 | ### Usage with Standalone-based Applications
|
30 | 33 |
|
31 |
| -:::caution |
| 34 | +:::warning |
32 | 35 | All Ionic imports should be imported from the `@ionic/angular/standalone` submodule. This includes imports such as components, directives, providers, and types. Importing from `@ionic/angular` may pull in lazy loaded Ionic code which can interfere with treeshaking.
|
33 | 36 | :::
|
34 | 37 |
|
@@ -175,9 +178,32 @@ export class HomePage {}
|
175 | 178 | <ion-button routerLink="/foo" routerDirection="root">Go to Foo Page</ion-button>
|
176 | 179 | ```
|
177 | 180 |
|
| 181 | +**Testing** |
| 182 | + |
| 183 | +Ionic Angular's standalone components use ES Modules. As a result, developers using Jest should ensure that ES Modules are transpiled to a format that Jest can use. Developers using Jest should add the following to their Jest config: |
| 184 | + |
| 185 | +<Tabs groupId="package-manager" defaultValue="npm" values={[{ value: 'npm', label: 'npm' }, { value: 'pnpm', label: 'pnpm' }]}> |
| 186 | +<TabItem value="npm"> |
| 187 | + |
| 188 | +```json |
| 189 | + |
| 190 | +"transformIgnorePatterns": ["<rootDir>/node_modules/(?!(@ionic/angular|@ionic/core|ionicons|@stencil/core|@angular/*)/)"] |
| 191 | +``` |
| 192 | + |
| 193 | +</TabItem> |
| 194 | +<TabItem value="pnpm"> |
| 195 | + |
| 196 | +```json |
| 197 | + |
| 198 | +"transformIgnorePatterns": ["<rootDir>/node_modules/.pnpm/(?!(@ionic/angular|@ionic/core|ionicons|@stencil/core|@angular/*)@)"] |
| 199 | +``` |
| 200 | + |
| 201 | +</TabItem> |
| 202 | +</Tabs> |
| 203 | + |
178 | 204 | ### Usage with NgModule-based Applications
|
179 | 205 |
|
180 |
| -:::caution |
| 206 | +:::warning |
181 | 207 | All Ionic imports should be imported from the `@ionic/angular/standalone` submodule. This includes imports such as components, directives, providers, and types. Importing from `@ionic/angular` may pull in lazy loaded Ionic code which can interfere with treeshaking.
|
182 | 208 | :::
|
183 | 209 |
|
@@ -315,6 +341,29 @@ export class HomePageModule {}
|
315 | 341 | <ion-button routerLink="/foo" routerDirection="root">Go to Foo Page</ion-button>
|
316 | 342 | ```
|
317 | 343 |
|
| 344 | +**Testing** |
| 345 | + |
| 346 | +Ionic Angular's standalone components use ES Modules. As a result, developers using Jest should ensure that ES Modules are transpiled to a format that Jest can use. Developers using Jest should add the following to their Jest config: |
| 347 | + |
| 348 | +<Tabs groupId="package-manager" defaultValue="npm" values={[{ value: 'npm', label: 'npm' }, { value: 'pnpm', label: 'pnpm' }]}> |
| 349 | +<TabItem value="npm"> |
| 350 | + |
| 351 | +```json |
| 352 | + |
| 353 | +"transformIgnorePatterns": ["<rootDir>/node_modules/(?!(@ionic/angular|@ionic/core|ionicons|@stencil/core|@angular/*)/)"] |
| 354 | +``` |
| 355 | + |
| 356 | +</TabItem> |
| 357 | +<TabItem value="pnpm"> |
| 358 | + |
| 359 | +```json |
| 360 | + |
| 361 | +"transformIgnorePatterns": ["<rootDir>/node_modules/.pnpm/(?!(@ionic/angular|@ionic/core|ionicons|@stencil/core|@angular/*)@)"] |
| 362 | +``` |
| 363 | + |
| 364 | +</TabItem> |
| 365 | +</Tabs> |
| 366 | + |
318 | 367 | ## Modules
|
319 | 368 |
|
320 | 369 | ### Overview
|
|
0 commit comments