Skip to content

Commit

Permalink
fix: reverting to webpack 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartorn committed Nov 22, 2020
1 parent b16282b commit 43014ff
Show file tree
Hide file tree
Showing 23 changed files with 66 additions and 1,058 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"husky": "4.3.0",
"jest": "26.6.3",
"lerna": "3.22.1",
"webpack": "5.4.0"
"webpack": "4.44.2"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion packages/atoms/webpack-atom-js-react-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"postcss-mixins": "7.0.1",
"postcss-normalize": "9.0.0",
"postcss-preset-env": "6.7.0",
"webpack": "5.4.0",
"webpack": "4.44.2",
"webpack-cli": "4.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ const generateSourcemap = require("@thc/webpack-quark-sourcemap");

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

const enhanceForHotReload = (entries) => {
return ["@thc/webpack-quark-dev-server/lib/webpackHotDevClient"].concat(entries);
};

module.exports = (processEnv, argv) => {
const env = envDefaults(processEnv);
// Every function accepts a config object
Expand Down Expand Up @@ -49,14 +45,13 @@ module.exports = (processEnv, argv) => {
configEntries({
polyfill: ["core-js/stable", "regenerator-runtime/runtime"],
entries: { main: "./src/index.js" },
enhance: hotReload ? enhanceForHotReload : false,
enhance: false,
}),
addHotReload({
hot: hotReload,
serverConfig: {
DEV_SERVER_HOST: env.DEV_SERVER_HOST,
DEV_SERVER_PORT: env.DEV_SERVER_PORT,
},
host: env.DEV_SERVER_HOST,
port: env.DEV_SERVER_PORT,
static: env.OUTPUT_DIR,
}),
addHtmlIndex(),
miscOptions({
Expand Down
2 changes: 1 addition & 1 deletion packages/atoms/webpack-atom-js-react-scss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"postcss-mixins": "7.0.1",
"postcss-normalize": "9.0.0",
"postcss-preset-env": "6.7.0",
"webpack": "5.4.0",
"webpack": "4.44.2",
"webpack-cli": "4.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ const generateSourcemap = require("@thc/webpack-quark-sourcemap");

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

const enhanceForHotReload = (entries) => {
return ["@thc/webpack-quark-dev-server/lib/webpackHotDevClient"].concat(entries);
};

module.exports = (processEnv, argv) => {
const env = envDefaults(processEnv);
// Every function accepts a config object
Expand Down Expand Up @@ -49,14 +45,13 @@ module.exports = (processEnv, argv) => {
configEntries({
polyfill: ["core-js/stable", "regenerator-runtime/runtime"],
entries: { main: "./src/app.js" },
enhance: hotReload ? enhanceForHotReload : false,
enhance: false,
}),
addHotReload({
hot: hotReload,
serverConfig: {
DEV_SERVER_HOST: env.DEV_SERVER_HOST,
DEV_SERVER_PORT: env.DEV_SERVER_PORT,
},
host: env.DEV_SERVER_HOST,
port: env.DEV_SERVER_PORT,
static: env.OUTPUT_DIR,
}),
addHtmlIndex(),
miscOptions({
Expand Down
2 changes: 1 addition & 1 deletion packages/quarks/webpack-quark-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"url": "https://github.com/thc-tools/webpack-laboratory/issues"
},
"peerDependencies": {
"webpack": "^5.0.0"
"webpack": "^4.44.2"
},
"dependencies": {
"@thc/webpack-chemistry": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/quarks/webpack-quark-babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"url": "https://github.com/thc-tools/webpack-laboratory/issues"
},
"peerDependencies": {
"webpack": "^5.0.0"
"webpack": "^4.44.2"
},
"dependencies": {
"@thc/webpack-chemistry": "1.0.0",
Expand Down
20 changes: 10 additions & 10 deletions packages/quarks/webpack-quark-css/lib/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const { ensureConfig, safeMerge } = require("@thc/webpack-chemistry");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require("path");

module.exports = blockConfig => (processEnv, argv) => argConfig => {
module.exports = (blockConfig) => (processEnv, argv) => (argConfig) => {
const config = ensureConfig(argConfig);

const defaultCssConfig = {
test: /\.css$/,
extractCss: false, //processEnv.HOT_RELOAD !== "true",
filename: `css/[name]_${processEnv.npm_package_version}.bundle.css`, //`css/[name]_${processEnv.npm_package_version}.bundle.css`,
filename: `css/[name]_${processEnv.npm_package_version}.bundle.css`,
chunkFilename: "css/[name]_[hash].css",
cssLoaderOptions: {}
cssLoaderOptions: {},
};

const mergedCssBlockConf = safeMerge(defaultCssConfig, blockConfig);
Expand All @@ -26,28 +26,28 @@ module.exports = blockConfig => (processEnv, argv) => argConfig => {
test: mergedCssBlockConf.test,
use: [
{
loader: mergedCssBlockConf.extractCss ? MiniCssExtractPlugin.loader : "style-loader"
loader: mergedCssBlockConf.extractCss ? MiniCssExtractPlugin.loader : "style-loader",
},
{
loader: "css-loader",
options: {
importLoaders: nbLoaders,
...mergedCssBlockConf.cssLoaderOptions
}
...mergedCssBlockConf.cssLoaderOptions,
},
},
{
loader: "postcss-loader",
options: mergedCssBlockConf.postcssConfig
options: mergedCssBlockConf.postcssConfig,
},
...mergedCssBlockConf.additionalLoaders
]
...mergedCssBlockConf.additionalLoaders,
],
});

if (mergedCssBlockConf.extractCss) {
config.plugins.push(
new MiniCssExtractPlugin({
filename: mergedCssBlockConf.filename,
chunkFilename: mergedCssBlockConf.chunkFilename
chunkFilename: mergedCssBlockConf.chunkFilename,
})
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/quarks/webpack-quark-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"url": "https://github.com/thc-tools/webpack-laboratory/issues"
},
"peerDependencies": {
"webpack": "^5.0.0"
"webpack": "^4.44.2"
},
"dependencies": {
"@thc/webpack-chemistry": "1.0.0",
Expand Down
Loading

0 comments on commit 43014ff

Please sign in to comment.