Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Commit

Permalink
fix : resolved hot module reload issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mrellipse committed Sep 27, 2017
1 parent 2fb716d commit 8d49e3d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
16 changes: 15 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"port": 5858
},
{
"name": ".NET Core Launch (console)",
"name": ".NET Core (Development)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "dev build",
Expand All @@ -30,6 +30,20 @@
"externalConsole": false,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core (Production)",
"type": "coreclr",
"request": "launch",
"program": "${workspaceRoot}/dist/Toucan.UI.dll",
"args": [],
"env": {
"ASPNETCORE_ENVIRONMENT": "Production"
},
"cwd": "${workspaceRoot}/dist",
"externalConsole": true,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
}
]
}
2 changes: 2 additions & 0 deletions src/server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Toucan.Common.Extensions;
using Toucan.Contract;
using Toucan.Data;
using System.Collections.Generic;

namespace Toucan.Server
{
Expand All @@ -33,6 +34,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions()
{
HotModuleReplacement = true,
HotModuleReplacementEndpoint = "/dist", // this value must be the same as 'output.publicPath' in webpack.config.js
ProjectPath = Path.Combine(Directory.GetCurrentDirectory(), @"..\ui")
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "toucan.ui",
"version": "2.0.2",
"version": "2.0.4",
"description": "UI project for Toucan template",
"keywords": [
"vuejs",
Expand Down Expand Up @@ -67,4 +67,4 @@
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
}
}
}
4 changes: 2 additions & 2 deletions src/ui/webpack-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const merge = require('webpack-merge');
const autoprefixer = require('autoprefixer');
const webpackHtml = require('html-webpack-plugin');

module.exports = (outputPath, srcPath) => {
module.exports = (outputPath, srcPath, publicPath) => {

const plugins = [

Expand Down Expand Up @@ -130,7 +130,7 @@ module.exports = (outputPath, srcPath) => {
},
output: {
path: outputPath,
publicPath: '/',
publicPath: publicPath,
filename: '[name].js'
},
plugins: plugins,
Expand Down
3 changes: 2 additions & 1 deletion src/ui/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module.exports = () => {

const srcPath = path.resolve(__dirname, './app');

const config = webpackBase(outputPath, srcPath);
// set publicPath to '/dist/' is so that .net core webpack middleware can proxy incoming requests to node.js middleware
const config = webpackBase(outputPath, srcPath, '/dist/');

const definePlugin = new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"'
Expand Down
2 changes: 1 addition & 1 deletion src/ui/webpack.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = () => {

const srcPath = path.resolve(__dirname, './app');

const config = webpackBase(outputPath, srcPath);
const config = webpackBase(outputPath, srcPath, '/');

const definePlugin = new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
Expand Down

0 comments on commit 8d49e3d

Please sign in to comment.