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

19.2.8 • 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
18.2.18129,924v18-lts
16.2.16108,520v16-lts
19.2.893,669latest
15.2.1187,392v15-lts
17.3.1685,019v17-lts
14.2.1373,599v14-lts
13.3.1142,111v13-lts
12.2.1829,115v12-lts
11.2.1919,303v11-lts
8.3.2917,695v8-lts
9.1.1511,701v9-lts
7.3.108,739v7-lts
10.2.48,370v10-lts
6.2.92,982v6-lts
20.0.0-next.61,168next

Version History

VersionDownloads (Last 7 Days)Published
20.0.0-next.61,168
19.2.893,669
20.0.0-next.55,587
19.2.7191,152
18.2.18129,924
17.3.1685,019
20.0.0-next.4904
19.2.670,576
18.2.1722,154
17.3.1511,807
20.0.0-next.3616
19.2.550,706
18.2.1622,263
17.3.1410,206
20.0.0-next.2123
19.2.440,115
17.3.1315,126
19.2.343,826
18.2.1534,893
20.0.0-next.15
19.2.26,132
20.0.0-next.0386
19.2.142,078
19.2.032,994
19.1.98,281
19.2.0-rc.056
19.1.823,564
19.2.0-next.2389
19.1.720,740
17.3.1227,520
19.1.622,210
19.2.0-next.19
19.1.526,067
18.2.1486,104
18.2.133,495
19.2.0-next.04
19.1.416,393
19.1.34,528
19.1.23,059
19.1.16,599
19.1.0722
19.1.0-rc.05
19.0.723,225
19.1.0-next.26
19.0.627,768
19.1.0-next.133
19.0.58,304
19.0.410,549
19.1.0-next.0109
19.0.31,799
19.0.24,294
19.0.12,194
19.0.04,009
19.0.0-rc.33
19.0.0-rc.24
18.2.12122,552
19.0.0-rc.113
19.0.0-rc.04
18.2.1126,244
19.0.0-next.135
18.2.1018,415
17.3.1189,683
19.0.0-next.128
19.0.0-next.114
18.2.933,976
19.0.0-next.103
18.2.821,017
19.0.0-next.95
18.2.718,134
19.0.0-next.87
18.2.69,300
17.3.1016,421
19.0.0-next.74
18.2.512,709
16.2.16108,520
19.0.0-next.67
19.0.0-next.53
19.0.0-next.43
18.2.430,991
19.0.0-next.333
18.2.39,383
17.3.917,904
16.2.153,799
18.2.25,836
19.0.0-next.24
19.0.0-next.14
18.2.134,342
19.0.0-next.04
18.2.06,831
18.2.0-rc.03
18.1.421,958
18.2.0-next.33
18.1.315,823
18.2.0-next.225
18.1.27,168
18.2.0-next.13
18.1.15,316
18.2.0-next.04
18.1.08,249
18.1.0-rc.13
18.0.76,503
18.1.0-rc.03
18.0.63,346
18.1.0-next.35
18.0.54,337
18.1.0-next.24
18.0.42,560
18.1.0-next.169
18.0.32,659
18.1.0-next.08
18.0.25,584
18.0.12,411
18.0.0395
17.3.864,658
18.0.0-rc.317
18.0.0-rc.26
17.3.713,269
18.0.0-rc.152
18.0.0-rc.03
18.0.0-next.510
18.0.0-next.45
17.3.613,139
18.0.0-next.330
17.3.513,225
17.3.45,915
16.2.1429,063
18.0.0-next.24
17.3.37,923
18.0.0-next.13
17.3.27,094
16.2.134,248
15.2.1187,392
18.0.0-next.03
17.3.13,399
17.3.08,249
17.3.0-rc.045
17.2.38,776
17.2.23,404
17.2.14,821
17.2.08,531
17.1.45,549
17.2.0-rc.09
17.1.32,969
17.2.0-next.13
17.1.24,551
17.2.0-next.05
17.1.14,126
16.2.1218,214
17.1.05,866
17.1.0-rc.15
17.0.104,042
17.1.0-rc.015
17.0.93,472
17.1.0-next.34
17.0.82,549
16.2.115,422
17.1.0-next.29
17.0.726,572
17.1.0-next.134
17.0.62,769
17.0.52,424
17.1.0-next.016
17.0.426
17.0.32,504
17.0.2284
17.0.11,049
17.0.05,327
16.2.1016,035
17.0.0-rc.54
17.0.0-rc.4346
17.0.0-rc.35
16.2.95,623
17.0.0-rc.217
17.0.0-rc.13
16.2.84,021
16.2.74,144
17.0.0-rc.06
17.0.0-next.95
17.0.0-next.84
16.2.66,160
15.2.1021,093
14.2.1373,599
17.0.0-next.74
16.2.52,263
17.0.0-next.613
16.2.42,300
17.0.0-next.524
16.2.32,469
17.0.0-next.44
16.2.23,865
17.0.0-next.34
17.0.0-next.07
16.2.15,924
16.2.016,292
16.1.83,091
16.2.0-rc.18
16.2.0-rc.04
16.1.7280
16.2.0-next.439
16.1.61,615
16.2.0-next.340
16.1.51,185
16.2.0-next.238
16.2.0-next.14
16.1.43,645
16.1.31,724
15.2.918,147
16.2.0-next.01,163
16.1.2182
14.2.1210,066
16.1.12,341
16.1.05,222
16.0.61,290
16.1.0-rc.05
16.0.5847
16.1.0-next.23
16.0.41,350
16.1.0-next.17
16.0.31,489
16.1.0-next.03
16.0.23,255
16.0.12,682
16.0.03,565
15.2.87,656
16.0.0-rc.437
16.0.0-rc.34
16.0.0-rc.24
15.2.72,866
16.0.0-rc.17
16.0.0-rc.042
15.2.65,033
16.0.0-next.73
15.2.52,581
16.0.0-next.612
16.0.0-next.54
15.2.47,574
14.2.119,273
13.3.1142,111
16.0.0-next.410
15.2.3121
16.0.0-next.33
15.2.21,306
16.0.0-next.23
15.2.11,491
16.0.0-next.15
16.0.0-next.04
15.2.03,925
15.2.0-rc.06
15.1.67,587
15.2.0-next.46
15.1.51,131
15.2.0-next.34
15.1.42,392
15.2.0-next.25
15.1.32,302
15.2.0-next.13
15.1.22,538
15.2.0-next.05
15.1.11,210
15.1.0920
15.1.0-rc.08
15.0.52,421
15.1.0-next.34
15.0.43,249
15.1.0-next.217
15.0.3950
15.1.0-next.14
15.0.21,061
15.1.0-next.05
15.0.11,023
13.3.106,257
14.2.1015,407
15.0.01,413
15.0.0-rc.53
15.0.0-rc.43
15.0.0-rc.36
14.2.92,253
15.0.0-rc.2231
14.2.81,337
15.0.0-rc.13
14.2.71,955
15.0.0-rc.06
15.0.0-next.65
14.2.63,845
15.0.0-next.53
15.0.0-next.413
14.2.51,251
15.0.0-next.34
14.2.42,596
15.0.0-next.223
15.0.0-next.14
14.2.33,746
15.0.0-next.08
14.2.21,691
14.2.13,471
14.2.0719
14.2.0-rc.06
14.2.0-next.23
14.1.32,153
14.2.0-next.15
14.1.21,086
14.2.0-next.08
14.1.11,470
12.2.1829,115
14.1.02,444
14.0.71,277
13.3.96,268
14.1.0-rc.37
14.0.6888
14.1.0-next.415
14.0.52,334
14.1.0-next.35
14.0.4970
14.1.0-next.23
14.0.3614
14.1.0-next.1188
14.0.21,001
13.3.82,077
14.1.0-next.03
14.0.1405
14.0.01,524
14.0.0-rc.38
14.0.0-rc.217
13.3.71,461
14.0.0-rc.15
13.3.6692
14.0.0-rc.06
14.0.0-next.135
13.3.53,216
14.0.0-next.123
13.3.41,143
14.0.0-next.114
14.0.0-next.105
14.0.0-next.95
13.3.31,661
14.0.0-next.83
13.3.2678
12.2.174,182
11.2.1919,303
14.0.0-next.73
13.3.1810
14.0.0-next.611
13.3.01,331
13.2.66,375
14.0.0-next.53
14.0.0-next.43
14.0.0-next.38
13.2.54,724
14.0.0-next.25
13.2.41,082
14.0.0-next.111
13.2.32,199
14.0.0-next.06
13.2.21,480
13.2.1556
12.2.162,641
13.2.0597
13.2.0-rc.14
13.2.0-rc.04
13.1.43,931
11.2.181,483
12.2.15569
13.1.3544
13.2.0-next.24
11.2.17180
10.2.48,370
11.2.1655
13.2.0-next.14
13.1.21,884
13.1.1396
13.2.0-next.03
13.1.0177
13.1.0-rc.04
12.2.141,667
13.1.0-next.320
13.0.42,229
13.1.0-next.23
13.0.32,188
13.1.0-next.14
13.0.2466
13.0.1311
13.1.0-next.03
12.2.131,497
13.0.037
13.0.0-rc.33
13.0.0-rc.25
12.2.12518
11.2.15722
13.0.0-rc.14
12.2.11382
13.0.0-rc.03
12.2.10456
13.0.0-next.94
12.2.9440
13.0.0-next.83
12.2.8198
13.0.0-next.75
12.2.7834
13.0.0-next.63
13.0.0-next.54
12.2.6384
13.0.0-next.43
12.2.5425
13.0.0-next.33
12.2.4311
13.0.0-next.23
12.2.3869
13.0.0-next.16
12.2.2984
13.0.0-next.03
12.2.11,703
12.2.0638
12.2.0-rc.04
12.1.44,042
12.2.0-next.33
12.1.3383
12.2.0-next.23
12.1.2938
12.1.11,159
12.2.0-next.04
12.1.0323
12.1.0-next.64
12.0.54,518
12.1.0-next.53
12.0.47,344
11.2.143,434
12.0.3708
12.1.0-next.43
12.0.2704
12.1.0-next.33
12.0.1793
12.1.0-next.23
11.2.13750
12.0.01,195
12.0.0-rc.333
12.0.0-rc.24
11.2.12991
11.2.11673
12.0.0-rc.14
12.0.0-rc.03
11.2.10891
12.0.0-next.94
11.2.9419
12.0.0-next.83
11.2.8712
11.2.7323
12.0.0-next.73
11.2.61,466
12.0.0-next.63
12.0.0-next.54
11.2.5270
12.0.0-next.44
11.2.41,023
12.0.0-next.34
11.2.3886
9.1.1511,701
10.2.32,155
11.2.2625
12.0.0-next.24
11.2.1887
12.0.0-next.13
12.0.0-next.03
11.2.0326
9.1.1469
10.2.2322
11.1.41,550
11.2.0-rc.120
11.1.3109
11.2.0-rc.03
11.1.21,058
11.2.0-next.03
11.1.1253
11.1.093
11.1.0-rc.04
11.0.77,119
11.0.6525
11.1.0-next.451
10.2.12,466
9.1.132,171
11.0.5622
11.1.0-next.34
11.1.0-next.24
11.0.4488
11.1.0-next.14
11.0.3338
11.1.0-next.021
11.0.2745
11.0.11,056
11.0.0282
11.0.0-rc.33
11.0.0-rc.24
11.0.0-rc.14
11.0.0-rc.05
10.2.01,815
10.1.710,469
11.0.0-next.74
10.1.6372
11.0.0-next.63
11.0.0-next.54
10.1.5250
11.0.0-next.44
10.1.4451
10.1.3216
11.0.0-next.33
10.1.2171
11.0.0-next.23
10.1.1179
11.0.0-next.13
11.0.0-next.03
10.1.0257
10.0.88,280
10.1.0-rc.04
10.1.0-next.73
10.0.7221
10.1.0-next.64
10.0.6760
10.1.0-next.53
10.1.0-next.44
10.1.0-next.33
10.0.5557
8.3.2917,695
9.1.121,342
10.1.0-next.24
10.0.42,022
10.0.3220
10.1.0-next.14
9.1.11372
10.0.2164
10.1.0-next.04
9.1.10165
10.0.1222
10.0.0897
8.3.28345
9.1.91,562
10.0.0-rc.55
10.0.0-rc.44
8.3.2766
9.1.8245
10.0.0-rc.34
10.0.0-rc.24
9.1.7868
10.0.0-rc.04
10.0.0-next.65
10.0.0-next.55
9.1.6389
9.1.5123
10.0.0-next.45
9.1.4594
10.0.0-next.36
10.0.0-next.25
9.1.3365
10.0.0-next.16
9.1.244
10.0.0-next.05
9.1.1444
7.3.108,739
8.3.261,081
9.1.0886
9.1.0-rc.04
9.1.0-next.48
9.0.75,385
9.0.6482
9.1.0-next.35
9.1.0-next.214
9.0.5271
9.0.4315
9.1.0-next.16
9.1.0-next.06
9.0.3219
9.0.2347
9.0.1462
9.0.015
8.3.251,468
9.0.0-rc.1427
9.0.0-rc.134
8.3.24544
9.0.0-rc.124
9.0.0-rc.113
9.0.0-rc.108
8.3.231,099
9.0.0-rc.94
8.3.22311
9.0.0-rc.86
9.0.0-rc.73
8.3.21473
9.0.0-rc.612
9.0.0-rc.53
8.3.20706
9.0.0-rc.44
9.0.0-rc.312
9.0.0-rc.24
8.3.19300
8.3.1873
9.0.0-rc.13
9.0.0-rc.07
8.3.17203
9.0.0-next.195
8.3.1666
9.0.0-next.185
9.0.0-next.175
8.3.1584
9.0.0-next.165
9.0.0-next.157
8.3.14169
9.0.0-next.145
8.3.1315
9.0.0-next.135
8.3.1265
9.0.0-next.126
9.0.0-next.118
8.3.1039
9.0.0-next.105
8.3.998
9.0.0-next.95
9.0.0-next.85
8.3.8108
9.0.0-next.75
8.3.787
9.0.0-next.65
8.3.6131
8.3.5165
9.0.0-next.55
8.3.4235
9.0.0-next.423
9.0.0-next.36
8.3.3157
9.0.0-next.26
8.3.2202
8.3.1308
9.0.0-next.15
9.0.0-next.06
8.3.0118
8.3.0-rc.03
8.2.23,142
8.3.0-next.25
8.3.0-next.15
8.2.1203
8.2.0226
8.3.0-next.06
8.1.31,815
8.2.0-rc.03
8.2.0-next.17
8.1.2312
8.2.0-next.06
8.1.160
8.1.079
8.0.61,611
8.0.54
8.1.0-rc.04
8.1.0-beta.33
8.0.426
8.1.0-beta.210
8.1.0-beta.13
8.1.0-beta.03
8.0.3236
8.0.2242
8.0.187
8.0.0167
8.0.0-rc.44
8.0.0-rc.33
7.3.93,532
8.0.0-rc.24
8.0.0-rc.14
8.0.0-rc.04
8.0.0-beta.183
8.0.0-beta.174
8.0.0-beta.163
8.0.0-beta.154
8.0.0-beta.144
8.0.0-beta.134
8.0.0-beta.124
8.0.0-beta.114
7.3.81,280
8.0.0-beta.1011
7.3.746
8.0.0-beta.93
8.0.0-beta.83
8.0.0-beta.74
7.3.6538
8.0.0-beta.63
7.3.596
8.0.0-beta.54
7.3.4163
8.0.0-beta.45
8.0.0-beta.23
7.3.387
8.0.0-beta.13
7.3.2179
7.3.1341
8.0.0-beta.04
7.3.0582
7.2.41,607
7.3.0-rc.03
7.2.3247
7.2.2371
7.3.0-beta.03
7.2.182
7.2.098
6.2.92,982
7.2.0-rc.03
7.1.41,002
7.2.0-beta.24
7.1.374
7.2.0-beta.13
7.1.239
7.1.148
7.2.0-beta.04
6.2.8106
7.1.0201
7.0.71,917
7.1.0-rc.05
7.0.6158
7.0.523
7.1.0-beta.14
6.2.792
7.1.0-beta.04
7.0.4170
7.0.3155
6.2.6542
7.0.2158
7.0.1133
6.2.536
7.0.0-rc.313
7.0.0-rc.23
7.0.0-rc.14
6.2.427
7.0.0-rc.05
7.0.0-beta.44
6.2.399
7.0.0-beta.34
6.2.210
7.0.0-beta.23
7.0.0-beta.14
7.0.0-beta.04
6.2.134
6.2.0243
6.2.0-rc.13
6.2.0-rc.03
6.1.51,072
6.1.4108
6.2.0-beta.39
6.2.0-beta.27
6.1.370
6.2.0-beta.14
6.2.0-beta.05
6.1.297
6.1.130
6.1.059
6.1.0-rc.33
6.1.0-rc.26
6.1.0-rc.14
6.1.0-rc.012
6.1.0-beta.23
6.0.87,882
6.1.0-beta.19
6.1.0-beta.04
6.0.7112
6.0.6-14
6.0.551
6.0.44
6.0.3139
6.0.27
6.0.1105
6.0.0647
6.0.0-rc.1118
6.0.0-rc.103
6.0.0-rc.93
6.0.0-rc.84
6.0.0-rc.73
6.0.0-rc.63
6.0.0-rc.53
6.0.0-rc.43
6.0.0-rc.34
6.0.0-rc.2.45
6.0.0-rc.2.36
6.0.0-rc.2.25
6.0.0-rc.23
6.0.0-rc.14
6.0.0-rc.04
6.0.0-beta.94
6.0.0-beta.87
6.0.0-beta.74
6.0.0-beta.633
6.0.0-beta.54
1.10.27,898
6.0.0-beta.441
6.0.0-beta.33
1.10.1394
6.0.0-beta.24
1.10.0222
1.10.0-rc.03
1.9.8543
1.10.0-beta.37
1.9.7272
1.9.6625
1.10.0-beta.24
1.10.0-beta.15
1.9.5513
1.7.5323
1.8.636
1.10.0-beta.03
1.9.473
1.9.3200
1.9.258
1.9.148
1.9.0166
1.9.0-rc.24
1.9.0-rc.17
1.8.5385
1.9.0-rc.06
1.8.4140
1.8.348
1.8.2113
1.9.0-beta.26
1.9.0-beta.14
1.8.15
1.9.0-beta.04
1.8.0845
1.8.0-rc.84
1.8.0-rc.74
1.8.0-rc.63
1.8.0-rc.53
1.8.0-rc.43
1.8.0-rc.33
1.8.0-rc.24
1.8.0-rc.14
1.8.0-rc.03
1.7.4591
1.7.34
1.8.0-beta.43
1.8.0-beta.35
1.8.0-beta.23
1.7.2187
1.8.0-beta.14
1.7.1286
1.8.0-beta.04
1.7.094
1.7.0-rc.25
1.7.0-rc.14
1.7.0-rc.06
1.6.2823
1.7.0-beta.23
1.7.0-beta.14
1.6.1108
1.7.0-beta.03
1.6.0203
1.5.629
1.6.0-rc.53
1.6.0-rc.43
1.6.0-rc.36
1.5.5441
1.6.0-rc.23
1.5.4186
1.6.0-rc.14
1.5.369
1.6.0-rc.029
1.5.26
1.6.0-beta.14
1.5.183
1.6.0-beta.03
1.5.0296
1.5.0-rc.13
1.4.250
1.5.0-rc.03
1.5.0-beta.13
1.4.1101
1.4.032
1.4.0-rc.23
1.3.368
1.4.0-rc.13
1.3.24
1.3.1168
1.3.0216
1.2.1421
1.2.1347
1.2.1220
1.2.1120
1.2.1042
1.2.914
1.2.84
1.2.74
1.2.63
1.2.53
1.2.431
1.2.35
1.2.25
1.2.13
1.2.05
1.1.93
1.1.84
1.1.63
1.1.74
1.1.57
1.1.44
1.1.33
1.1.24
1.1.13
1.1.05
1.0.03
0.1.0-beta.03

Package Sidebar

Install

npm i @ngtools/webpack

Weekly Downloads

3,026,036

Version

19.2.8

License

MIT

Unpacked Size

144 kB

Total Files

47

Last publish

Collaborators

  • angular
  • google-wombot