mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 10:45:51 +03:00
Fix wrong variables in webpack config
This commit is contained in:
parent
fd32037f23
commit
71dcb0dd0d
1 changed files with 8 additions and 8 deletions
|
@ -47,7 +47,7 @@ module.exports = (env, argv) => {
|
||||||
nodeEnv = "production";
|
nodeEnv = "production";
|
||||||
}
|
}
|
||||||
const devMode = nodeEnv !== 'production';
|
const devMode = nodeEnv !== 'production';
|
||||||
const useCssHotReload = process.env.CSS_HOT_RELOAD === '1' && devMode;
|
const useHMR = process.env.CSS_HOT_RELOAD === '1' && devMode;
|
||||||
|
|
||||||
const development = {};
|
const development = {};
|
||||||
if (argv.mode === "production") {
|
if (argv.mode === "production") {
|
||||||
|
@ -90,7 +90,7 @@ module.exports = (env, argv) => {
|
||||||
"mobileguide": "./src/vector/mobile_guide/index.ts",
|
"mobileguide": "./src/vector/mobile_guide/index.ts",
|
||||||
"jitsi": "./src/vector/jitsi/index.ts",
|
"jitsi": "./src/vector/jitsi/index.ts",
|
||||||
"usercontent": "./node_modules/matrix-react-sdk/src/usercontent/index.js",
|
"usercontent": "./node_modules/matrix-react-sdk/src/usercontent/index.js",
|
||||||
...(useCssHotReload ? {} : cssThemes),
|
...(useHMR ? {} : cssThemes),
|
||||||
},
|
},
|
||||||
|
|
||||||
optimization: {
|
optimization: {
|
||||||
|
@ -174,7 +174,7 @@ module.exports = (env, argv) => {
|
||||||
/olm[\\/](javascript[\\/])?olm\.js$/,
|
/olm[\\/](javascript[\\/])?olm\.js$/,
|
||||||
],
|
],
|
||||||
rules: [
|
rules: [
|
||||||
useCssHotReload && {
|
useHMR && {
|
||||||
test: /devcss\.ts$/,
|
test: /devcss\.ts$/,
|
||||||
loader: 'string-replace-loader',
|
loader: 'string-replace-loader',
|
||||||
options: {
|
options: {
|
||||||
|
@ -209,7 +209,7 @@ module.exports = (env, argv) => {
|
||||||
options: {
|
options: {
|
||||||
cacheDirectory: true,
|
cacheDirectory: true,
|
||||||
plugins: [
|
plugins: [
|
||||||
development && require.resolve('react-refresh/babel'),
|
useHMR && require.resolve('react-refresh/babel'),
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -270,7 +270,7 @@ module.exports = (env, argv) => {
|
||||||
* of the JS/TS files.
|
* of the JS/TS files.
|
||||||
* Should be MUCH better with webpack 5, but we're stuck to this solution for now.
|
* Should be MUCH better with webpack 5, but we're stuck to this solution for now.
|
||||||
*/
|
*/
|
||||||
useCssHotReload ? {
|
useHMR ? {
|
||||||
loader: 'style-loader',
|
loader: 'style-loader',
|
||||||
/**
|
/**
|
||||||
* If we refactor the `theme.js` in `matrix-react-sdk` a little bit,
|
* If we refactor the `theme.js` in `matrix-react-sdk` a little bit,
|
||||||
|
@ -469,8 +469,8 @@ module.exports = (env, argv) => {
|
||||||
|
|
||||||
// This exports our CSS using the splitChunks and loaders above.
|
// This exports our CSS using the splitChunks and loaders above.
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: useCssHotReload ? "bundles/[name].css" : "bundles/[hash]/[name].css",
|
filename: useHMR ? "bundles/[name].css" : "bundles/[hash]/[name].css",
|
||||||
chunkFilename: useCssHotReload ? "bundles/[name].css" : "bundles/[hash]/[name].css",
|
chunkFilename: useHMR ? "bundles/[name].css" : "bundles/[hash]/[name].css",
|
||||||
ignoreOrder: false, // Enable to remove warnings about conflicting order
|
ignoreOrder: false, // Enable to remove warnings about conflicting order
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ module.exports = (env, argv) => {
|
||||||
new HtmlWebpackInjectPreload({
|
new HtmlWebpackInjectPreload({
|
||||||
files: [{ match: /.*Inter.*\.woff2$/ }],
|
files: [{ match: /.*Inter.*\.woff2$/ }],
|
||||||
}),
|
}),
|
||||||
development && new ReactRefreshWebpackPlugin(),
|
useHMR && new ReactRefreshWebpackPlugin(),
|
||||||
|
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue