fix(webpack|angular): platform suffixed files printing error when changed

This commit is contained in:
Igor Randjelovic
2021-04-15 22:46:34 +02:00
parent 759f05a53a
commit a9eed7e4c6
2 changed files with 9 additions and 2 deletions

View File

@@ -331,6 +331,7 @@ exports[`angular configuration for android 1`] = `
{
tsConfigPath: '__jest__/tsconfig.json',
mainPath: '__jest__/src/app.js',
forkTypeChecker: false,
hostReplacementPaths: function () { /* omitted long function */ },
platformTransformers: [
function () { /* omitted long function */ }
@@ -680,6 +681,7 @@ exports[`angular configuration for ios 1`] = `
{
tsConfigPath: '__jest__/tsconfig.json',
mainPath: '__jest__/src/app.js',
forkTypeChecker: false,
hostReplacementPaths: function () { /* omitted long function */ },
platformTransformers: [
function () { /* omitted long function */ }

View File

@@ -48,7 +48,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// exclude component css files from the normal css rule
config.module
.rule('css')
.exclude// exclude *.component.{platform}.css
.exclude // exclude *.component.{platform}.css
.add(/\.component(\.\w+)?\.css$/);
// and instead use raw-loader, since that's what angular expects
@@ -67,7 +67,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// exclude component css files from the normal css rule
config.module
.rule('scss')
.exclude// exclude *.component.{platform}.scss
.exclude // exclude *.component.{platform}.scss
.add(/\.component(\.\w+)?\.scss$/);
// and instead use raw-loader, since that's what angular expects
@@ -88,6 +88,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
{
tsConfigPath,
mainPath: getEntryPath(),
// disable type checking in a forked process - it ignores
// the hostReplacementPaths and prints errors about
// platform suffixed files, even though they are
// working as expected.
forkTypeChecker: false,
hostReplacementPaths(path: string) {
const ext = extname(path);
const platformExt = `.${platform}${ext}`;