@ngtools/webpack
TypeScript icon, indicating that this package has built-in type declarations

19.1.5 • Public • Published

Angular Compiler Webpack Plugin

Webpack 5.x plugin for the Angular Ahead-of-Time compiler. The plugin also supports Angular JIT mode. When this plugin is used outside of the Angular CLI, the Ivy linker will also be needed to support the usage of Angular libraries. An example configuration of the Babel-based Ivy linker is provided in the linker section. For additional information regarding the linker, please see: https://angular.dev/tools/libraries/creating-libraries#consuming-partial-ivy-code-outside-the-angular-cli

Usage

In your webpack config, add the following plugin and loader.

import { AngularWebpackPlugin } from '@ngtools/webpack';

exports = {
  /* ... */
  module: {
    rules: [
      /* ... */
      {
        test: /\.[jt]sx?$/,
        loader: '@ngtools/webpack',
      },
    ],
  },

  plugins: [
    new AngularWebpackPlugin({
      tsconfig: 'path/to/tsconfig.json',
      // ... other options as needed
    }),
  ],
};

The loader works with webpack plugin to compile the application's TypeScript. It is important to include both, and to not include any other TypeScript loader.

Options

  • tsconfig [default: tsconfig.json] - The path to the application's TypeScript Configuration file. In the tsconfig.json, you can pass options to the Angular Compiler with angularCompilerOptions. Relative paths will be resolved from the Webpack compilation's context.
  • compilerOptions [default: none] - Overrides options in the application's TypeScript Configuration file (tsconfig.json).
  • jitMode [default: false] - Enables JIT compilation and do not refactor the code to bootstrap. This replaces templateUrl: "string" with template: require("string") (and similar for styles) to allow for webpack to properly link the resources.
  • directTemplateLoading [default: true] - Causes the plugin to load component templates (HTML) directly from the filesystem. This is more efficient if only using the raw-loader to load component templates. Do not enable this option if additional loaders are configured for component templates.
  • fileReplacements [default: none] - Allows replacing TypeScript files with other TypeScript files in the build. This option acts on fully resolved file paths.
  • inlineStyleFileExtension [default: none] - When set inline component styles will be processed by Webpack as files with the provided extension.

Ivy Linker

The Ivy linker can be setup by using the Webpack babel-loader package. If not already installed, add the babel-loader package using your project's package manager. Then in your webpack config, add the babel-loader with the following configuration. If the babel-loader is already present in your configuration, the linker plugin can be added to the existing loader configuration as well. Enabling caching for the babel-loader is recommended to avoid reprocessing libraries on every build. For additional information regarding the babel-loader package, please see: https://github.com/babel/babel-loader/tree/main#readme

import linkerPlugin from '@angular/compiler-cli/linker/babel';

exports = {
  /* ... */
  module: {
    rules: [
      /* ... */
      {
        test: /\.[cm]?js$/,
        use: {
          loader: 'babel-loader',
          options: {
            cacheDirectory: true,
            compact: false,
            plugins: [linkerPlugin],
          },
        },
      },
    ],
  },
};

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
17.3.11211,289v17-lts
16.2.16105,020v16-lts
15.2.1185,468v15-lts
14.2.1382,825v14-lts
13.3.1144,768v13-lts
12.2.1831,835v12-lts
8.3.2923,190v8-lts
11.2.1920,171v11-lts
9.1.1512,671v9-lts
19.1.510,898latest
18.2.1410,397v18-lts
7.3.108,374v7-lts
10.2.48,290v10-lts
6.2.92,462v6-lts
19.2.0-next.1202next

Version History

VersionDownloads (Last 7 Days)Published
19.2.0-next.1202
19.1.510,898
18.2.1410,397
18.2.136,153
19.2.0-next.01,988
19.1.4159,138
19.1.324,435
19.1.29,973
19.1.112,107
19.1.02,596
19.1.0-rc.02,911
19.0.743,435
19.1.0-next.27
19.0.645,307
19.1.0-next.1548
19.0.515,762
19.0.415,548
19.1.0-next.0709
19.0.31,662
19.0.28,382
19.0.14,529
19.0.03,741
19.0.0-rc.333
19.0.0-rc.20
18.2.12290,874
19.0.0-rc.14
19.0.0-rc.049
18.2.1150,938
19.0.0-next.1319
18.2.1022,886
17.3.11211,289
19.0.0-next.127
19.0.0-next.111
18.2.933,973
19.0.0-next.101
18.2.822,561
19.0.0-next.92
18.2.723,352
19.0.0-next.84
18.2.612,631
17.3.1024,356
19.0.0-next.720
18.2.518,371
16.2.16105,020
19.0.0-next.63
19.0.0-next.50
19.0.0-next.40
18.2.424,475
19.0.0-next.30
18.2.312,356
17.3.921,396
16.2.154,747
18.2.210,294
19.0.0-next.23
19.0.0-next.11
18.2.136,087
19.0.0-next.04
18.2.010,937
18.2.0-rc.01
18.1.424,613
18.2.0-next.31
18.1.316,274
18.2.0-next.24
18.1.29,853
18.2.0-next.11
18.1.110,508
18.2.0-next.00
18.1.010,619
18.1.0-rc.11
18.0.78,112
18.1.0-rc.01
18.0.64,366
18.1.0-next.30
18.0.55,292
18.1.0-next.20
18.0.44,108
18.1.0-next.165
18.0.34,842
18.1.0-next.02
18.0.27,893
18.0.11,958
18.0.0583
17.3.878,599
18.0.0-rc.312
18.0.0-rc.21
17.3.717,373
18.0.0-rc.10
18.0.0-rc.02
18.0.0-next.511
18.0.0-next.42
17.3.619,823
18.0.0-next.38
17.3.511,306
17.3.48,659
16.2.1446,741
18.0.0-next.21
17.3.38,637
18.0.0-next.10
17.3.25,973
16.2.134,886
15.2.1185,468
18.0.0-next.01
17.3.13,952
17.3.08,116
17.3.0-rc.068
17.2.39,257
17.2.23,713
17.2.13,961
17.2.07,821
17.1.45,405
17.2.0-rc.03
17.1.33,272
17.2.0-next.10
17.1.25,734
17.2.0-next.00
17.1.15,021
16.2.1225,114
17.1.08,286
17.1.0-rc.13
17.0.105,690
17.1.0-rc.02
17.0.95,102
17.1.0-next.33
17.0.83,052
16.2.116,452
17.1.0-next.22
17.0.723,763
17.1.0-next.11
17.0.62,805
17.0.52,475
17.1.0-next.00
17.0.485
17.0.33,650
17.0.2282
17.0.11,144
17.0.02,063
16.2.1013,973
17.0.0-rc.50
17.0.0-rc.41
17.0.0-rc.33
16.2.96,253
17.0.0-rc.234
17.0.0-rc.10
16.2.83,011
16.2.74,782
17.0.0-rc.00
17.0.0-next.90
17.0.0-next.81
16.2.65,308
15.2.1029,682
14.2.1382,825
17.0.0-next.70
16.2.51,995
17.0.0-next.61
16.2.42,699
17.0.0-next.50
16.2.32,488
17.0.0-next.40
16.2.24,072
17.0.0-next.311
17.0.0-next.01
16.2.16,351
16.2.06,306
16.1.85,066
16.2.0-rc.11
16.2.0-rc.00
16.1.7339
16.2.0-next.40
16.1.61,840
16.2.0-next.313
16.1.51,523
16.2.0-next.211
16.2.0-next.13
16.1.43,973
16.1.32,469
15.2.919,280
16.2.0-next.0788
16.1.2211
14.2.129,673
16.1.12,207
16.1.03,512
16.0.61,089
16.1.0-rc.00
16.0.5840
16.1.0-next.21
16.0.41,333
16.1.0-next.10
16.0.31,520
16.1.0-next.00
16.0.21,353
16.0.13,125
16.0.02,166
15.2.88,850
16.0.0-rc.40
16.0.0-rc.30
16.0.0-rc.21
15.2.72,906
16.0.0-rc.16
16.0.0-rc.07
15.2.66,201
16.0.0-next.70
15.2.52,674
16.0.0-next.65
16.0.0-next.50
15.2.47,912
14.2.118,850
13.3.1144,768
16.0.0-next.413
15.2.3137
16.0.0-next.31
15.2.21,367
16.0.0-next.20
15.2.12,005
16.0.0-next.10
16.0.0-next.00
15.2.01,770
15.2.0-rc.00
15.1.65,944
15.2.0-next.41
15.1.51,073
15.2.0-next.30
15.1.41,716
15.2.0-next.21
15.1.32,032
15.2.0-next.10
15.1.21,801
15.2.0-next.01
15.1.1712
15.1.0356
15.1.0-rc.011
15.0.52,014
15.1.0-next.32
15.0.42,928
15.1.0-next.23
15.0.31,174
15.1.0-next.12
15.0.2949
15.1.0-next.00
15.0.1498
13.3.107,645
14.2.1017,460
15.0.0539
15.0.0-rc.50
15.0.0-rc.40
15.0.0-rc.32
14.2.92,043
15.0.0-rc.2177
14.2.81,296
15.0.0-rc.14
14.2.71,933
15.0.0-rc.02
15.0.0-next.60
14.2.63,651
15.0.0-next.50
15.0.0-next.41
14.2.51,361
15.0.0-next.32
14.2.41,857
15.0.0-next.216
15.0.0-next.10
14.2.32,341
15.0.0-next.00
14.2.21,206
14.2.12,924
14.2.0642
14.2.0-rc.03
14.2.0-next.26
14.1.32,649
14.2.0-next.10
14.1.21,023
14.2.0-next.02
14.1.11,174
12.2.1831,835
14.1.02,529
14.0.71,304
13.3.97,030
14.1.0-rc.319
14.0.61,068
14.1.0-next.42
14.0.51,637
14.1.0-next.33
14.0.4524
14.1.0-next.20
14.0.3534
14.1.0-next.1156
14.0.21,211
13.3.82,912
14.1.0-next.02
14.0.1336
14.0.01,190
14.0.0-rc.31
14.0.0-rc.27
13.3.71,630
14.0.0-rc.10
13.3.6570
14.0.0-rc.01
14.0.0-next.130
13.3.52,198
14.0.0-next.124
13.3.41,250
14.0.0-next.112
14.0.0-next.100
14.0.0-next.92
13.3.31,400
14.0.0-next.82
13.3.2606
12.2.174,020
11.2.1920,171
14.0.0-next.70
13.3.1726
14.0.0-next.61
13.3.01,159
13.2.66,582
14.0.0-next.50
14.0.0-next.40
14.0.0-next.32
13.2.52,875
14.0.0-next.22
13.2.4866
14.0.0-next.19
13.2.31,440
14.0.0-next.03
13.2.21,228
13.2.1711
12.2.161,849
13.2.0564
13.2.0-rc.12
13.2.0-rc.02
13.1.43,234
11.2.181,316
12.2.15585
13.1.3591
13.2.0-next.20
11.2.17120
10.2.48,290
11.2.1620
13.2.0-next.10
13.1.21,656
13.1.1262
13.2.0-next.01
13.1.0142
13.1.0-rc.00
12.2.141,523
13.1.0-next.39
13.0.42,861
13.1.0-next.20
13.0.31,776
13.1.0-next.11
13.0.2512
13.0.1211
13.1.0-next.01
12.2.131,444
13.0.023
13.0.0-rc.32
13.0.0-rc.21
12.2.12590
11.2.15740
13.0.0-rc.10
12.2.11306
13.0.0-rc.00
12.2.10341
13.0.0-next.90
12.2.9340
13.0.0-next.80
12.2.8176
13.0.0-next.72
12.2.7848
13.0.0-next.62
13.0.0-next.51
12.2.6407
13.0.0-next.41
12.2.5456
13.0.0-next.30
12.2.4242
13.0.0-next.21
12.2.3675
13.0.0-next.10
12.2.2641
13.0.0-next.00
12.2.1817
12.2.0293
12.2.0-rc.00
12.1.44,080
12.2.0-next.30
12.1.3364
12.2.0-next.21
12.1.2628
12.1.1784
12.2.0-next.08
12.1.0488
12.1.0-next.60
12.0.53,827
12.1.0-next.53
12.0.43,136
11.2.143,109
12.0.3587
12.1.0-next.43
12.0.2264
12.1.0-next.30
12.0.1583
12.1.0-next.20
11.2.13697
12.0.0504
12.0.0-rc.30
12.0.0-rc.22
11.2.12978
11.2.11550
12.0.0-rc.12
12.0.0-rc.03
11.2.10745
12.0.0-next.92
11.2.9361
12.0.0-next.82
11.2.8341
11.2.7307
12.0.0-next.70
11.2.6690
12.0.0-next.60
12.0.0-next.50
11.2.5257
12.0.0-next.42
11.2.4372
12.0.0-next.30
11.2.3417
9.1.1512,671
10.2.31,971
11.2.2190
12.0.0-next.20
11.2.1493
12.0.0-next.10
12.0.0-next.02
11.2.0143
9.1.1494
10.2.2233
11.1.41,824
11.2.0-rc.122
11.1.372
11.2.0-rc.00
11.1.2884
11.2.0-next.00
11.1.1322
11.1.026
11.1.0-rc.00
11.0.76,065
11.0.6255
11.1.0-next.420
10.2.12,385
9.1.132,163
11.0.5481
11.1.0-next.30
11.1.0-next.20
11.0.4339
11.1.0-next.10
11.0.3269
11.1.0-next.010
11.0.2889
11.0.1202
11.0.0174
11.0.0-rc.31
11.0.0-rc.21
11.0.0-rc.15
11.0.0-rc.03
10.2.01,526
10.1.713,996
11.0.0-next.71
10.1.6487
11.0.0-next.61
11.0.0-next.50
10.1.5211
11.0.0-next.42
10.1.4364
10.1.3271
11.0.0-next.31
10.1.2180
11.0.0-next.22
10.1.1115
11.0.0-next.12
11.0.0-next.02
10.1.0213
10.0.85,732
10.1.0-rc.00
10.1.0-next.73
10.0.7152
10.1.0-next.60
10.0.6302
10.1.0-next.50
10.1.0-next.41
10.1.0-next.31
10.0.5491
8.3.2923,190
9.1.121,112
10.1.0-next.22
10.0.4990
10.0.3187
10.1.0-next.10
9.1.11328
10.0.2125
10.1.0-next.00
9.1.10192
10.0.1191
10.0.0568
8.3.28302
9.1.9778
10.0.0-rc.51
10.0.0-rc.40
8.3.27116
9.1.8287
10.0.0-rc.31
10.0.0-rc.20
9.1.7626
10.0.0-rc.01
10.0.0-next.61
10.0.0-next.516
9.1.6500
9.1.5216
10.0.0-next.41
9.1.4406
10.0.0-next.30
10.0.0-next.21
9.1.3372
10.0.0-next.10
9.1.251
10.0.0-next.01
9.1.1518
7.3.108,374
8.3.261,075
9.1.0760
9.1.0-rc.00
9.1.0-next.40
9.0.74,335
9.0.6386
9.1.0-next.31
9.1.0-next.216
9.0.5244
9.0.4269
9.1.0-next.11
9.1.0-next.01
9.0.3165
9.0.2341
9.0.1601
9.0.011
8.3.251,213
9.0.0-rc.1413
9.0.0-rc.130
8.3.24587
9.0.0-rc.120
9.0.0-rc.111
9.0.0-rc.105
8.3.231,036
9.0.0-rc.93
8.3.22276
9.0.0-rc.867
9.0.0-rc.71
8.3.21439
9.0.0-rc.60
9.0.0-rc.53
8.3.20573
9.0.0-rc.40
9.0.0-rc.39
9.0.0-rc.20
8.3.19324
8.3.1885
9.0.0-rc.10
9.0.0-rc.09
8.3.17174
9.0.0-next.191
8.3.1610
9.0.0-next.180
9.0.0-next.170
8.3.1579
9.0.0-next.160
9.0.0-next.150
8.3.14108
9.0.0-next.140
8.3.1316
9.0.0-next.131
8.3.1281
9.0.0-next.120
9.0.0-next.111
8.3.1030
9.0.0-next.101
8.3.995
9.0.0-next.90
9.0.0-next.81
8.3.8174
9.0.0-next.71
8.3.720
9.0.0-next.60
8.3.685
8.3.5120
9.0.0-next.51
8.3.4291
9.0.0-next.41
9.0.0-next.31
8.3.3177
9.0.0-next.20
8.3.2117
8.3.1284
9.0.0-next.10
9.0.0-next.00
8.3.055
8.3.0-rc.01
8.2.22,799
8.3.0-next.21
8.3.0-next.10
8.2.1110
8.2.0321
8.3.0-next.00
8.1.31,595
8.2.0-rc.00
8.2.0-next.11
8.1.2257
8.2.0-next.01
8.1.1118
8.1.0111
8.0.61,853
8.0.52
8.1.0-rc.00
8.1.0-beta.31
8.0.443
8.1.0-beta.26
8.1.0-beta.11
8.1.0-beta.01
8.0.3177
8.0.2345
8.0.179
8.0.0191
8.0.0-rc.40
8.0.0-rc.31
7.3.92,941
8.0.0-rc.20
8.0.0-rc.10
8.0.0-rc.01
8.0.0-beta.180
8.0.0-beta.170
8.0.0-beta.160
8.0.0-beta.150
8.0.0-beta.140
8.0.0-beta.130
8.0.0-beta.123
8.0.0-beta.112
7.3.81,224
8.0.0-beta.1013
7.3.7103
8.0.0-beta.91
8.0.0-beta.80
8.0.0-beta.71
7.3.6382
8.0.0-beta.60
7.3.5112
8.0.0-beta.51
7.3.4168
8.0.0-beta.40
8.0.0-beta.21
7.3.394
8.0.0-beta.10
7.3.2110
7.3.1383
8.0.0-beta.00
7.3.0763
7.2.41,561
7.3.0-rc.00
7.2.3125
7.2.2300
7.3.0-beta.00
7.2.1251
7.2.061
6.2.92,462
7.2.0-rc.00
7.1.41,154
7.2.0-beta.20
7.1.329
7.2.0-beta.10
7.1.248
7.1.111
7.2.0-beta.00
6.2.864
7.1.0124
7.0.71,415
7.1.0-rc.01
7.0.6547
7.0.521
7.1.0-beta.11
6.2.739
7.1.0-beta.00
7.0.491
7.0.3163
6.2.61,124
7.0.2179
7.0.150
6.2.548
7.0.0-rc.32
7.0.0-rc.21
7.0.0-rc.10
6.2.447
7.0.0-rc.00
7.0.0-beta.40
6.2.3146
7.0.0-beta.30
6.2.223
7.0.0-beta.20
7.0.0-beta.10
7.0.0-beta.00
6.2.155
6.2.0175
6.2.0-rc.11
6.2.0-rc.00
6.1.51,071
6.1.459
6.2.0-beta.330
6.2.0-beta.20
6.1.352
6.2.0-beta.11
6.2.0-beta.01
6.1.250
6.1.127
6.1.091
6.1.0-rc.30
6.1.0-rc.21
6.1.0-rc.10
6.1.0-rc.00
6.1.0-beta.21
6.0.86,261
6.1.0-beta.18
6.1.0-beta.01
6.0.7152
6.0.6-11
6.0.563
6.0.41
6.0.3100
6.0.25
6.0.1248
6.0.0975
6.0.0-rc.1131
6.0.0-rc.100
6.0.0-rc.90
6.0.0-rc.80
6.0.0-rc.70
6.0.0-rc.61
6.0.0-rc.50
6.0.0-rc.40
6.0.0-rc.33
6.0.0-rc.2.40
6.0.0-rc.2.30
6.0.0-rc.2.20
6.0.0-rc.21
6.0.0-rc.10
6.0.0-rc.00
6.0.0-beta.91
6.0.0-beta.88
6.0.0-beta.72
6.0.0-beta.66
6.0.0-beta.51
1.10.27,319
6.0.0-beta.49
6.0.0-beta.30
1.10.1502
6.0.0-beta.21
1.10.0243
1.10.0-rc.01
1.9.8448
1.10.0-beta.31
1.9.789
1.9.6462
1.10.0-beta.21
1.10.0-beta.10
1.9.5417
1.7.5309
1.8.657
1.10.0-beta.00
1.9.475
1.9.3233
1.9.234
1.9.148
1.9.0244
1.9.0-rc.20
1.9.0-rc.11
1.8.5339
1.9.0-rc.01
1.8.4109
1.8.352
1.8.239
1.9.0-beta.20
1.9.0-beta.11
1.8.16
1.9.0-beta.00
1.8.0580
1.8.0-rc.80
1.8.0-rc.70
1.8.0-rc.61
1.8.0-rc.50
1.8.0-rc.41
1.8.0-rc.30
1.8.0-rc.20
1.8.0-rc.11
1.8.0-rc.00
1.7.4445
1.7.39
1.8.0-beta.40
1.8.0-beta.30
1.8.0-beta.20
1.7.2255
1.8.0-beta.10
1.7.1290
1.8.0-beta.01
1.7.0110
1.7.0-rc.20
1.7.0-rc.10
1.7.0-rc.00
1.6.2555
1.7.0-beta.20
1.7.0-beta.11
1.6.179
1.7.0-beta.00
1.6.0188
1.5.626
1.6.0-rc.50
1.6.0-rc.40
1.6.0-rc.30
1.5.5307
1.6.0-rc.21
1.5.4205
1.6.0-rc.11
1.5.349
1.6.0-rc.00
1.5.27
1.6.0-beta.10
1.5.185
1.6.0-beta.01
1.5.0180
1.5.0-rc.10
1.4.243
1.5.0-rc.01
1.5.0-beta.11
1.4.1147
1.4.056
1.4.0-rc.21
1.3.369
1.4.0-rc.11
1.3.22
1.3.1192
1.3.0251
1.2.1417
1.2.1372
1.2.1221
1.2.118
1.2.1018
1.2.926
1.2.82
1.2.71
1.2.63
1.2.51
1.2.421
1.2.31
1.2.21
1.2.13
1.2.02
1.1.93
1.1.81
1.1.62
1.1.71
1.1.54
1.1.418
1.1.31
1.1.21
1.1.12
1.1.01
1.0.01
0.1.0-beta.01

Package Sidebar

Install

npm i @ngtools/webpack

Weekly Downloads

1,866,296

Version

19.1.5

License

MIT

Unpacked Size

144 kB

Total Files

47

Last publish

Collaborators

  • angular
  • google-wombot