Skip to content

Commit c68f40f

Browse files
edusperonirigor789
andauthored
feat(webpack): support NG 13 and zone async/await (NativeScript#9676)
* feat(webpack): support NG 13 and zone async/await * chore: cleanup * chore: remove require.resolve and update snapshots Co-authored-by: Igor Randjelovic <[email protected]>
1 parent 37cc612 commit c68f40f

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

packages/webpack5/__tests__/configuration/__snapshots__/angular.spec.ts.snap

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,26 @@ exports[`angular configuration for android 1`] = `
178178
}
179179
]
180180
},
181+
/* config.module.rule('angular-webpack-loader') */
182+
{
183+
test: /\\\\.[cm]?[tj]sx?$/,
184+
exclude: [
185+
/[/\\\\\\\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\\\\\\\]/
186+
],
187+
use: [
188+
/* config.module.rule('angular-webpack-loader').use('webpack-loader') */
189+
{
190+
loader: '@angular-devkit/build-angular/src/babel/webpack-loader',
191+
options: {
192+
scriptTarget: 99,
193+
aot: true
194+
}
195+
}
196+
],
197+
resolve: {
198+
fullySpecified: false
199+
}
200+
},
181201
/* config.module.rule('angular') */
182202
{
183203
test: /(?:\\\\.ngfactory.js|\\\\.ngstyle\\\\.js|\\\\.ts)$/,
@@ -559,6 +579,26 @@ exports[`angular configuration for ios 1`] = `
559579
}
560580
]
561581
},
582+
/* config.module.rule('angular-webpack-loader') */
583+
{
584+
test: /\\\\.[cm]?[tj]sx?$/,
585+
exclude: [
586+
/[/\\\\\\\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\\\\\\\]/
587+
],
588+
use: [
589+
/* config.module.rule('angular-webpack-loader').use('webpack-loader') */
590+
{
591+
loader: '@angular-devkit/build-angular/src/babel/webpack-loader',
592+
options: {
593+
scriptTarget: 99,
594+
aot: true
595+
}
596+
}
597+
],
598+
resolve: {
599+
fullySpecified: false
600+
}
601+
},
562602
/* config.module.rule('angular') */
563603
{
564604
test: /(?:\\\\.ngfactory.js|\\\\.ngstyle\\\\.js|\\\\.ts)$/,

packages/webpack5/src/configuration/angular.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { ScriptTarget } from 'typescript';
12
import { extname, resolve } from 'path';
2-
import { merge } from 'webpack-merge';
33
import Config from 'webpack-chain';
44
import { existsSync } from 'fs';
55

@@ -167,6 +167,23 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
167167
.use('angular-hot-loader')
168168
.loader('angular-hot-loader');
169169
});
170+
// zone + async/await
171+
config.module
172+
.rule('angular-webpack-loader')
173+
.test(/\.[cm]?[tj]sx?$/)
174+
.exclude.add(
175+
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\]/
176+
)
177+
.end()
178+
.resolve.set('fullySpecified', false)
179+
.end()
180+
.before('angular')
181+
.use('webpack-loader')
182+
.loader('@angular-devkit/build-angular/src/babel/webpack-loader')
183+
.options({
184+
scriptTarget: ScriptTarget.ESNext,
185+
aot: true,
186+
});
170187
}
171188

172189
// look for platform specific polyfills first

0 commit comments

Comments
 (0)