Bladeren bron

[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
Mackinnon Buck 3 jaren geleden
bovenliggende
commit
5a1bfe2af9

+ 4 - 4
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)"

+ 1 - 1
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: {

+ 0 - 3
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>