diff options
author | Mackinnon Buck <mackinnon.buck@gmail.com> | 2022-09-14 00:20:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-14 00:20:41 +0300 |
commit | 5a1bfe2af92cdc9c519917847a940cdbd6430ce7 (patch) | |
tree | 7b1a9f53eacb8d1a80b66279d975275e0cb66ce0 | |
parent | 2676b598963fddcca4f8b2edb0ba33b9b23f940c (diff) |
[release/7.0] Add a JS initializer for the Blazor custom elements package (#43809)
* Add JS initializer for custom elements package
* Remove additional JS file
* Debugging E2E test failures in CI
* JS is always compiled before output is included
3 files changed, 5 insertions, 8 deletions
diff --git a/src/Components/CustomElements/src/Microsoft.AspNetCore.Components.CustomElements.csproj b/src/Components/CustomElements/src/Microsoft.AspNetCore.Components.CustomElements.csproj index 95c2b5ab32..89a6de6851 100644 --- a/src/Components/CustomElements/src/Microsoft.AspNetCore.Components.CustomElements.csproj +++ b/src/Components/CustomElements/src/Microsoft.AspNetCore.Components.CustomElements.csproj @@ -23,7 +23,7 @@ <ItemGroup> <YarnInputs Include="$(YarnWorkingDir)**" Exclude="$(YarnWorkingDir)node_modules\**;$(YarnWorkingDir)*.d.ts;$(YarnWorkingDir)dist\**" /> - <YarnOutputs Include="$(YarnWorkingDir)dist\$(Configuration)\BlazorCustomElements.js" /> + <YarnOutputs Include="$(YarnWorkingDir)dist\$(Configuration)\Microsoft.AspNetCore.Components.CustomElements.lib.module.js" /> <Content Remove="$(YarnWorkingDir)**" /> <None Include="$(YarnWorkingDir)*" Exclude="$(YarnWorkingDir)node_modules\**" /> @@ -47,7 +47,7 @@ <ItemGroup> <FileWrites Include="$(JsCompilationCacheFile)" /> </ItemGroup> - + </Target> <Target Name="CompileJs" Condition="'$(BuildNodeJS)' != 'false' AND '$(DesignTimeBuild)' != 'true'" Inputs="$(JsCompilationCacheFile)" Outputs="@(YarnOutputs)"> @@ -59,13 +59,13 @@ </Target> - <Target Name="IncludeCompileJsOutput"> + <Target Name="IncludeCompileJsOutput" BeforeTargets="_ResolveJsModuleInputs" DependsOnTargets="CompileJs"> <ItemGroup> <_JsBuildOutput Include="$(YarnWorkingDir)dist\$(Configuration)\**" Exclude="$(YarnWorkingDir)dist\.gitignore" /> </ItemGroup> <DefineStaticWebAssets Condition="'@(_JsBuildOutput)' != ''" - SourceType="Computed" + SourceType="Discovered" SourceId="$(PackageId)" ContentRoot="$(YarnWorkingDir)dist\$(Configuration)\" BasePath="_content\$(PackageId)" diff --git a/src/Components/CustomElements/src/js/webpack.config.js b/src/Components/CustomElements/src/js/webpack.config.js index 5dacdcf860..6de6802110 100644 --- a/src/Components/CustomElements/src/js/webpack.config.js +++ b/src/Components/CustomElements/src/js/webpack.config.js @@ -12,7 +12,7 @@ module.exports = (env, args) => ({ rules: [{ test: /\.ts?$/, loader: 'ts-loader' }] }, entry: { - 'BlazorCustomElements': './BlazorCustomElements.ts', + 'Microsoft.AspNetCore.Components.CustomElements.lib.module': './BlazorCustomElements.ts', }, output: { path: path.join(__dirname, 'dist', args.mode == 'development' ? 'Debug' : 'Release'), filename: '[name].js' }, performance: { diff --git a/src/Components/test/testassets/BasicTestApp/wwwroot/index.html b/src/Components/test/testassets/BasicTestApp/wwwroot/index.html index 9048aa6427..86ee65077e 100644 --- a/src/Components/test/testassets/BasicTestApp/wwwroot/index.html +++ b/src/Components/test/testassets/BasicTestApp/wwwroot/index.html @@ -52,9 +52,6 @@ <!-- Used by ExternalContentPackage --> <script src="_content/TestContentPackage/prompt.js"></script> - - <!-- Used by CustomElementsComponent --> - <script src="_content/Microsoft.AspNetCore.Components.CustomElements/BlazorCustomElements.js"></script> </body> </html> |