mirror of https://github.com/zulip/zulip.git
Revert "webpack: Use cache-loader for various loaders."
This reverts commit eb53b5e8de
.
This appeared to not have the right logic yet for handling branch
switches.
See https://chat.zulip.org/#narrow/stream/3-backend/topic/frontend.20hot.20reloading/near/749259 for details.
This commit is contained in:
parent
9be6b79945
commit
5d0e144d62
|
@ -1,13 +1,6 @@
|
||||||
import { basename, resolve } from 'path';
|
import { basename } from 'path';
|
||||||
import { RuleSetRule } from 'webpack';
|
import { RuleSetRule } from 'webpack';
|
||||||
|
|
||||||
export const cacheLoader: RuleSetRule = {
|
|
||||||
loader: 'cache-loader',
|
|
||||||
options: {
|
|
||||||
cacheDirectory: resolve(__dirname, '../var/webpack-cache'),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Return imports-loader format to the config
|
/* Return imports-loader format to the config
|
||||||
For example:
|
For example:
|
||||||
[
|
[
|
||||||
|
@ -24,7 +17,7 @@ function getImportLoaders(optionsArr: ImportLoaderOptions[]): RuleSetRule[] {
|
||||||
for (var loaderEntry of optionsArr) {
|
for (var loaderEntry of optionsArr) {
|
||||||
importsLoaders.push({
|
importsLoaders.push({
|
||||||
test: require.resolve(loaderEntry.path),
|
test: require.resolve(loaderEntry.path),
|
||||||
use: [cacheLoader, "imports-loader?" + loaderEntry.args],
|
use: "imports-loader?" + loaderEntry.args,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return importsLoaders;
|
return importsLoaders;
|
||||||
|
@ -51,7 +44,7 @@ function getExposeLoaders(optionsArr: ExportLoaderOptions[]): RuleSetRule[] {
|
||||||
for (var loaderEntry of optionsArr) {
|
for (var loaderEntry of optionsArr) {
|
||||||
const path = loaderEntry.path;
|
const path = loaderEntry.path;
|
||||||
let name = "";
|
let name = "";
|
||||||
const useArr = [cacheLoader];
|
const useArr = [];
|
||||||
// If no name is provided, infer it
|
// If no name is provided, infer it
|
||||||
if (!loaderEntry.name) {
|
if (!loaderEntry.name) {
|
||||||
name = basename(path, '.js');
|
name = basename(path, '.js');
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as webpack from 'webpack';
|
||||||
// The devServer member of webpack.Configuration is managed by the
|
// The devServer member of webpack.Configuration is managed by the
|
||||||
// webpack-dev-server package. We are only importing the type here.
|
// webpack-dev-server package. We are only importing the type here.
|
||||||
import * as _webpackDevServer from 'webpack-dev-server';
|
import * as _webpackDevServer from 'webpack-dev-server';
|
||||||
import { getExposeLoaders, getImportLoaders, cacheLoader } from './webpack-helpers';
|
import { getExposeLoaders, getImportLoaders } from './webpack-helpers';
|
||||||
import * as MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
import * as MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
|
|
||||||
const assets = require('./webpack.assets.json');
|
const assets = require('./webpack.assets.json');
|
||||||
|
@ -42,13 +42,12 @@ export default (env?: string): webpack.Configuration => {
|
||||||
{
|
{
|
||||||
// We dont want to match admin.js
|
// We dont want to match admin.js
|
||||||
test: /(\.min|min\.|zxcvbn)\.js/,
|
test: /(\.min|min\.|zxcvbn)\.js/,
|
||||||
use: [cacheLoader, 'script-loader'],
|
use: ['script-loader'],
|
||||||
},
|
},
|
||||||
// regular css files
|
// regular css files
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
use: getHotCSS([
|
use: getHotCSS([
|
||||||
cacheLoader,
|
|
||||||
MiniCssExtractPlugin.loader,
|
MiniCssExtractPlugin.loader,
|
||||||
{
|
{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
|
@ -62,7 +61,6 @@ export default (env?: string): webpack.Configuration => {
|
||||||
{
|
{
|
||||||
test: /\.(sass|scss)$/,
|
test: /\.(sass|scss)$/,
|
||||||
use: getHotCSS([
|
use: getHotCSS([
|
||||||
cacheLoader,
|
|
||||||
MiniCssExtractPlugin.loader,
|
MiniCssExtractPlugin.loader,
|
||||||
{
|
{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
|
|
Loading…
Reference in New Issue