Skip to content

Commit

Permalink
fix: repairing dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartorn committed Nov 22, 2020
1 parent d16d57a commit 64abf05
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions packages/quarks/webpack-quark-dev-server/lib/hot-reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports = (blockConfig) => (processEnv, argv) => (argConfig) => {
const config = ensureConfig(argConfig);

if (mergedConf.hot) {
config.resolve.alias["react-dom"] = "@hot-loader/react-dom";
const serveOptions = {
hmr: "refresh-on-failure",
open: mergedConf.open,
Expand All @@ -36,7 +35,6 @@ module.exports = (blockConfig) => (processEnv, argv) => (argConfig) => {
historyFallback: true,
};

config.plugins.push(new webpack.HotModuleReplacementPlugin());
config.plugins.push(
new ReactRefreshWebpackPlugin({
overlay: {
Expand Down
12 changes: 4 additions & 8 deletions packages/quarks/webpack-quark-entry/lib/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@

const { ensureConfig, safeMerge } = require("@thc/webpack-chemistry");

module.exports = blockConfig => (processEnv, argv) => argConfig => {
module.exports = (blockConfig) => (processEnv, argv) => (argConfig) => {
const defaultConf = {
entries: {}
entries: {},
};
const mergedConf = safeMerge(defaultConf, blockConfig);
const config = ensureConfig(argConfig);

if (mergedConf.polyfill) {
config.entry.polyfill = mergedConf.polyfill;
}

const enhance = mergedConf.enhance ? mergedConf.enhance : elt => elt;
const enhance = mergedConf.enhance ? mergedConf.enhance : (elt) => elt;

for (let key in mergedConf.entries) {
config.entry[key] = enhance(mergedConf.entries[key]);
config.entry[key] = enhance((config.entry.polyfill || []).concat(mergedConf.entries[key]));
}

return config;
Expand Down
11 changes: 8 additions & 3 deletions packages/quarks/webpack-quark-misc/lib/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
const { ensureConfig, safeMerge } = require("@thc/webpack-chemistry");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
const DashboardPlugin = require("webpack-dashboard/plugin");

module.exports = blockConfig => (processEnv, argv) => argConfig => {
module.exports = (blockConfig) => (processEnv, argv) => (argConfig) => {
const defaultConf = {
ignored: /node_modules/,
stats: {
Expand All @@ -19,10 +20,10 @@ module.exports = blockConfig => (processEnv, argv) => argConfig => {
source: false,
errors: true,
errorDetails: true,
warnings: true
warnings: true,
},
caseSensitivePaths: true,
analyze: false
analyze: false,
};

const mergedConf = safeMerge(defaultConf, blockConfig);
Expand All @@ -35,6 +36,10 @@ module.exports = blockConfig => (processEnv, argv) => argConfig => {
config.plugins.push(new CaseSensitivePathsPlugin());
}

if (mergedConf.dashboard) {
config.plugins.push(new DashboardPlugin());
}

if (mergedConf.analyze) {
config.plugins.push(new BundleAnalyzerPlugin());
}
Expand Down
3 changes: 2 additions & 1 deletion packages/quarks/webpack-quark-misc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"dependencies": {
"@thc/webpack-chemistry": "1.0.1-beta.0",
"case-sensitive-paths-webpack-plugin": "2.3.0",
"webpack-bundle-analyzer": "4.1.0"
"webpack-bundle-analyzer": "4.1.0",
"webpack-dashboard": "3.2.1"
}
}

0 comments on commit 64abf05

Please sign in to comment.