fix: client HMR

This commit is contained in:
cha0s 2021-03-23 05:50:19 -05:00
parent 3b7ffa6cd0
commit 3aca5913bc
4 changed files with 38 additions and 34 deletions

View File

@ -3,5 +3,6 @@
!/.*
!src/**/*.js
!/test/**/*.js
/build
!/tests.js
!/virtual.js

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html lang="<%= htmlWebpackPlugin.options.lang %>">
<head>
<base href="/" />
<meta charset="utf-8">
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width"
/>
<link rel="icon" href="/favicon.png"/>
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="<%= htmlWebpackPlugin.options.appMountId %>">
<div class="debug-container"></div>
</div>
<script src="/latus.config.js"></script>
<%= htmlWebpackPlugin.tags.bodyTags %>
</body>
</html>

View File

@ -1,3 +1,11 @@
const {
basename,
dirname,
extname,
isAbsolute,
join,
} = require('path');
const {Latus, require: R} = require('@latus/core');
const clientPlugins = require('../client-plugins');
@ -43,7 +51,23 @@ module.exports = async (latus) => {
.options({
source: source.join('\n'),
});
if ('production' !== neutrino.config.get('mode')) {
paths.forEach((path) => {
if (isAbsolute(path)) {
return;
}
const resolved = R.resolve(path);
// Cheating for now...
const parts = resolved.split('/');
parts.splice(parts.indexOf('packages') + 2, 0, 'src');
let source = parts.join('/');
source = join(dirname(source), basename(source, extname(source)));
neutrino.config.resolve.alias
.set(`${path}$`, source);
neutrino.config.module
.rule('compile').include.add(dirname(source));
});
}
const testPaths = paths
.map((path) => [path, Latus.runtimePath(`${path}/test`)])
.filter(([, path]) => !!path);

View File

@ -1978,9 +1978,9 @@ camelcase@^6.0.0:
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001181:
version "1.0.30001187"
resolved "http://npm.cha0sdev/caniuse-lite/-/caniuse-lite-1.0.30001187.tgz#5706942631f83baa5a0218b7dfa6ced29f845438"
integrity sha512-w7/EP1JRZ9552CyrThUnay2RkZ1DXxKe/Q2swTC4+LElLh9RRYrL1Z+27LlakB8kzY0fSmHw9mc7XYDUKAKWMA==
version "1.0.30001204"
resolved "http://npm.cha0sdev/caniuse-lite/-/caniuse-lite-1.0.30001204.tgz#256c85709a348ec4d175e847a3b515c66e79f2aa"
integrity sha512-JUdjWpcxfJ9IPamy2f5JaRDCaqJOxDzOSKtbdx4rH9VivMd1vIzoPumsJa9LoMIi4Fx2BV2KZOxWhNkBjaYivQ==
chai@4.2.0:
version "4.2.0"
@ -2146,9 +2146,9 @@ color-name@~1.1.4:
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
colorette@^1.2.1:
version "1.2.1"
resolved "http://npm.cha0sdev/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b"
integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==
version "1.2.2"
resolved "http://npm.cha0sdev/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94"
integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==
commander@2.17.x:
version "2.17.1"
@ -2739,9 +2739,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.649:
version "1.3.664"
resolved "http://npm.cha0sdev/electron-to-chromium/-/electron-to-chromium-1.3.664.tgz#8fb039e2fa8ef3ab2568308464a28425d4f6e2a3"
integrity sha512-yb8LrTQXQnh9yhnaIHLk6CYugF/An50T20+X0h++hjjhVfgSp1DGoMSYycF8/aD5eiqS4QwaNhiduFvK8rifRg==
version "1.3.695"
resolved "http://npm.cha0sdev/electron-to-chromium/-/electron-to-chromium-1.3.695.tgz#955f419cf99137226180cc4cca2e59015a4e248d"
integrity sha512-lz66RliUqLHU1Ojxx1A4QUxKydjiQ79Y4dZyPobs2Dmxj5aVL2TM3KoQ2Gs7HS703Bfny+ukI3KOxwAB0xceHQ==
elliptic@^6.5.3:
version "6.5.4"
@ -5053,9 +5053,9 @@ node-modules-regexp@^1.0.0:
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=
node-releases@^1.1.70:
version "1.1.70"
resolved "http://npm.cha0sdev/node-releases/-/node-releases-1.1.70.tgz#66e0ed0273aa65666d7fe78febe7634875426a08"
integrity sha512-Slf2s69+2/uAD79pVVQo8uSiC34+g8GWY8UH2Qtqv34ZfhYrxpYpfzs9Js9d6O0mbDmALuxaTlplnBTnSELcrw==
version "1.1.71"
resolved "http://npm.cha0sdev/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb"
integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==
normalize-package-data@^2.3.2:
version "2.5.0"