Skip to content

Commit 8e4af56

Browse files
committed
Use pre-built js files instead of building on the fly
1 parent 7144b06 commit 8e4af56

File tree

9 files changed

+17389
-20
lines changed

9 files changed

+17389
-20
lines changed

eng/scripts/CodeCheck.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ try {
130130
& $dotnet run -p "$repoRoot/eng/tools/BaselineGenerator/"
131131
}
132132

133+
Write-Host "Re-generating blazor files"
134+
Invoke-Block {
135+
& $dotnet build -p "$repoRoot/src/Components/Microsoft.AspNetCore.Components.Browser.JS.npmproj"
136+
}
137+
133138
Write-Host "Run git diff to check for pending changes"
134139

135140
# Redirect stderr to stdout because PowerShell does not consistently handle output to stderr

src/Components/Browser.JS/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
node_modules/
2-
dist/

src/Components/Browser.JS/Microsoft.AspNetCore.Components.Browser.JS.npmproj

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,20 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<WebpackInputs Include="**\*.ts" Exclude="node_modules\**" />
11-
<WebPackOutputs Include="src\dist\blazor.webassembly.js" />
12-
<WebPackOutputs Include="src\dist\blazor.server.js" />
10+
<WebpackInputs Include="src\**\*.ts" />
11+
<WebPackOutputs Include="dist\**\blazor.webassembly.js" />
12+
<WebPackOutputs Include="dist\**\blazor.server.js" />
1313
</ItemGroup>
1414

1515
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
1616

17-
<!--
18-
Invoking build[.cmd|.sh] does not restore npm projects by default. This is a performance optimization.
19-
However, we want to ensure yarn's restored before a P2P build happens. We'll conservatively yarn install
20-
if the node_modules directory is missing.
21-
-->
22-
<Target Name="FastRestore" DependsOnTargets="Restore" Condition="!Exists('node_modules')" />
23-
2417
<!-- Override the default 'Build' target from eng/targets/Npm.Common.targets. -->
2518
<Target Name="Build"
26-
DependsOnTargets="FastRestore"
2719
Inputs="@(WebpackInputs)"
2820
Outputs="@(WebPackOutputs)">
2921
<RemoveDir Directories="dist" />
30-
<Yarn Command="run build:debug" Condition="'$(Configuration)' == 'Debug'" />
31-
<Yarn Command="run build:production" Condition="'$(Configuration)' != 'Debug'" />
22+
<Yarn Command="run build:debug" />
23+
<Yarn Command="run build:production" />
3224
</Target>
3325

3426
</Project>

src/Components/Browser.JS/dist/Debug/blazor.server.js

Lines changed: 14908 additions & 0 deletions
Large diffs are not rendered by default.

src/Components/Browser.JS/dist/Debug/blazor.webassembly.js

Lines changed: 2453 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Browser.JS/dist/Release/blazor.server.js

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Browser.JS/dist/Release/blazor.webassembly.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Browser.JS/src/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ module.exports = (env, args) => ({
1111
'blazor.webassembly': './Boot.WebAssembly.ts',
1212
'blazor.server': './Boot.Server.ts',
1313
},
14-
output: { path: path.join(__dirname, '/dist'), filename: '[name].js' }
14+
output: { path: path.join(__dirname, '/..', '/dist', args.mode == 'development' ? '/Debug' : '/Release'), filename: '[name].js' }
1515
});

src/Components/Server/src/Microsoft.AspNetCore.Components.Server.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@
4848

4949
<ItemGroup>
5050
<!-- We need .Browser.JS to build first so we can embed its .js output -->
51-
<EmbeddedResource Include="..\..\Browser.JS\src\dist\blazor.server.js" LogicalName="_framework\%(Filename)%(Extension)" />
51+
<EmbeddedResource Include="..\..\Browser.JS\dist\$(Configuration)\blazor.server.js" LogicalName="_framework\%(Filename)%(Extension)" />
5252
</ItemGroup>
5353

54-
<Target Name="_EnsureBrowserJS" BeforeTargets="CoreCompile">
55-
<MSBuild Projects="..\..\Browser.JS\Microsoft.AspNetCore.Components.Browser.JS.npmproj" Targets="Build" />
56-
</Target>
57-
5854
</Project>

0 commit comments

Comments
 (0)