Skip to content

Commit

Permalink
RDEV-5995 Introducing hot reload again
Browse files Browse the repository at this point in the history
  • Loading branch information
alvesmiguel1 committed Oct 26, 2023
1 parent 61544c8 commit 19fac74
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ViewGenerator/ViewGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AssemblyTitle>ViewGenerator</AssemblyTitle>
<Product>ViewGenerator</Product>
<Description>Generates .NET View bindings from typescript</Description>
<Version>1.1.15</Version>
<Version>1.1.16</Version>
<PackageId>ViewGenerator</PackageId>
<PackageTags>Library</PackageTags>

Expand Down
4 changes: 2 additions & 2 deletions ViewGenerator/tools/webpack/Plugins/CommonConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SassRuleSet from "../Rules/Sass";
import getTypeScriptRuleSet from "../Rules/TypeScript";
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";

let getCommonConfiguration = (libraryName: string, useCache: boolean, assemblyName?: string, pluginsRelativePath?: string): Configuration => {
let getCommonConfiguration = (libraryName: string, useCache: boolean, assemblyName?: string, pluginsRelativePath?: string, forHotReload?: boolean): Configuration => {

const entryMap: Dictionary<string> = {}
const outputMap: Dictionary<string> = {};
Expand Down Expand Up @@ -98,7 +98,7 @@ let getCommonConfiguration = (libraryName: string, useCache: boolean, assemblyNa
rules: [
SassRuleSet,
getResourcesRuleSet(assemblyName, pluginsAssembly),
getTypeScriptRuleSet()
getTypeScriptRuleSet(forHotReload)
]
},

Expand Down
4 changes: 2 additions & 2 deletions ViewGenerator/tools/webpack/Rules/TypeScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { RuleSetRule, RuleSetUseItem } from "webpack";

// .ts / .tsx files
const getTypeScriptRuleSet = (): RuleSetRule => {
const getTypeScriptRuleSet = (forHotReload: boolean): RuleSetRule => {

const TypeScriptRule: RuleSetRule = {
test: /\.tsx?$/i,
Expand All @@ -27,7 +27,7 @@ const getTypeScriptRuleSet = (): RuleSetRule => {
};

// thread-loader, ts-loader
TypeScriptRule.use = ruleSet.concat(threadLoaderRule, tsLoaderRule);
TypeScriptRule.use = forHotReload ? ruleSet.concat(tsLoaderRule) : ruleSet.concat(threadLoaderRule, tsLoaderRule);
return TypeScriptRule;
}

Expand Down
9 changes: 6 additions & 3 deletions ViewGenerator/tools/webpack/webpack_views.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const config = (env) => {

const sanitizedPluginsRelativePath: string = sanitizeCommandLineParam(env.pluginsRelativePath);

const standardConfig: Configuration = getCommonConfiguration("Views", env.useCache, sanitizeCommandLineParam(env.assemblyName), sanitizedPluginsRelativePath);
const standardConfig: Configuration = getCommonConfiguration("Views", env.useCache, sanitizeCommandLineParam(env.assemblyName), sanitizedPluginsRelativePath, env.forHotReload);

(standardConfig.cache as any).name = "viewsCache";

Expand Down Expand Up @@ -78,10 +78,13 @@ const config = (env) => {
];
}

if (env.useCache) {
if (env.forHotReload) {
// @ts-ignore
standardConfig.devServer = {
disableHostCheck: true
client: {
overlay: false
},
allowedHosts: "all"
};
}

Expand Down

0 comments on commit 19fac74

Please sign in to comment.