Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v2): Webpack 5, PostCSS 8 #4089

Merged
merged 157 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
849d9c0
Initial webpack 5 work
RDIL Jan 22, 2021
24c3817
It works on my machine (lol)
RDIL Feb 5, 2021
7b2f923
Committing a bit more work
RDIL Feb 9, 2021
9bfe9fb
It works - sorta
RDIL Feb 9, 2021
89e6cb3
Merge branch 'master' into webpack-5
RDIL Feb 9, 2021
82b7a4c
Update packages/docusaurus/package.json
RDIL Feb 9, 2021
09aaaeb
at least fix prettier /shrug
RDIL Feb 9, 2021
78dc506
making more progress. build should work now, css stuff is still a bit…
RDIL Feb 11, 2021
3ac46d3
Terser things
RDIL Feb 11, 2021
833fe54
Merge branch 'master' into webpack-5
RDIL Feb 11, 2021
31c6185
Working on things
RDIL Feb 11, 2021
5970897
Vendor webpack
RDIL Feb 11, 2021
8abd018
Repair chunks, and tests
RDIL Feb 11, 2021
41e4d87
Rerun prettier
RDIL Feb 11, 2021
97d4dad
Re-add client prefetching
RDIL Feb 11, 2021
90c9894
Update snapshots
RDIL Feb 11, 2021
90b1e22
Update snapshots
RDIL Feb 11, 2021
e82f654
I hope this works
RDIL Feb 11, 2021
0c73485
Remove redundant dev server code
RDIL Feb 12, 2021
5879eb7
relock
RDIL Feb 12, 2021
c38836b
Trying to reduce memory usage and fix things
RDIL Feb 12, 2021
f63cf76
Dead code elim
RDIL Feb 12, 2021
00a5147
Search bar works!!!
RDIL Feb 16, 2021
7d52dfc
Prefetching should work again
RDIL Feb 16, 2021
741d100
Merge branch 'master' into webpack-5
RDIL Feb 16, 2021
fc9138c
lock
RDIL Feb 16, 2021
67e4233
ts issue
RDIL Feb 16, 2021
d1907ac
Repair snapshot
RDIL Feb 16, 2021
51d9641
Run prettier
RDIL Feb 16, 2021
cfdac27
Fix the CI for now
RDIL Feb 17, 2021
a8e96ba
fix lint-prettier
RDIL Feb 17, 2021
127840b
clean-css works, now for the other one
RDIL Feb 18, 2021
f64b97d
Merge branch 'webpack-5' of https://github.com/RDIL/docusaurus into w…
RDIL Feb 19, 2021
de50f0e
Merge branch 'master' into webpack-5
RDIL Feb 19, 2021
78e18f4
Fix lockfile
RDIL Feb 19, 2021
7fc121a
Fixes prettier
RDIL Feb 19, 2021
d5b4309
Other css minification works!!!
RDIL Feb 19, 2021
c51c572
Add clean-css options, fix webpack versions
RDIL Feb 22, 2021
275c646
Merge branch 'master' into webpack-5
RDIL Feb 22, 2021
fab025e
Fix tests and several of the webpack loaders
RDIL Feb 22, 2021
66e7257
Re-add support for simple css minifier
RDIL Feb 22, 2021
c192a93
Merge branch 'master' into webpack-5
RDIL Feb 22, 2021
7ee130a
Update other related dependencies
RDIL Feb 22, 2021
fea4fbd
Merge branch 'master' into webpack-5
RDIL Feb 22, 2021
53cc534
Fix lockfile
RDIL Feb 22, 2021
b965ec2
Dev server fixups
RDIL Feb 24, 2021
c9caf4c
Simplify css things
RDIL Feb 24, 2021
ce04544
Update webpack, try with postcss 7
RDIL Mar 2, 2021
e46832c
Merge branch 'master' into webpack-5
RDIL Mar 4, 2021
d726233
Other cssnano repairs
RDIL Mar 4, 2021
9a9c69d
Merge branch 'master' into webpack-5
RDIL Mar 8, 2021
2f84c91
fix lockfile
RDIL Mar 8, 2021
7603a90
Clean up the babel preset
RDIL Mar 10, 2021
7844680
Merge branch 'master' into webpack-5
RDIL Mar 10, 2021
1281d67
Fix lockfile
RDIL Mar 10, 2021
d929c58
Bump RL SSR version
RDIL Mar 10, 2021
e3c9008
Merge branch 'master' into webpack-5
RDIL Mar 16, 2021
047aa97
Merge branch 'master' into webpack-5
RDIL Mar 17, 2021
0506b13
Fix the build errors
RDIL Mar 17, 2021
0bfd87e
Merge branch 'master' into webpack-5
RDIL Mar 22, 2021
1c8d6a2
Lockfile fix
RDIL Mar 22, 2021
e69486d
It works again
RDIL Mar 22, 2021
33b1f2d
webpack 5 should close compiler after run
slorber Mar 25, 2021
c481041
add proper webpack5 persistent caching config
slorber Mar 25, 2021
ba009d3
Merge branch 'master' into webpack-5
slorber Mar 25, 2021
bf142b2
upgrade webpack deps again
slorber Mar 25, 2021
be961ea
Merge branch 'master' into webpack-5
slorber Mar 25, 2021
907393e
reduce build perf timeouts to avoid build time regressions
slorber Mar 25, 2021
9392f0a
test if incremental build can run on netlify
slorber Mar 25, 2021
27e5f17
netlify test
slorber Mar 25, 2021
68d7cbf
netlify test
slorber Mar 25, 2021
483efe7
netlify test
slorber Mar 25, 2021
25c5b5c
netlify test
slorber Mar 25, 2021
1db5381
netlify test
slorber Mar 25, 2021
2c84f3e
netlify test
slorber Mar 25, 2021
8e2cc76
netlify test
slorber Mar 26, 2021
db47fca
netlify test
slorber Mar 26, 2021
ba4bc60
netlify test
slorber Mar 26, 2021
1d2810a
netlify test
slorber Mar 26, 2021
cb769a2
netlify test
slorber Mar 26, 2021
57139aa
netlify test
slorber Mar 26, 2021
eb00350
netlify test
slorber Mar 26, 2021
1c22b52
netlify test
slorber Mar 26, 2021
94ff214
netlify test
slorber Mar 26, 2021
d52c82f
test
slorber Mar 26, 2021
b6cb026
test
slorber Mar 26, 2021
f3445a3
test
slorber Mar 26, 2021
7f8e812
test
slorber Mar 26, 2021
eaa6a47
netlify test
slorber Mar 26, 2021
2747940
netlify test
slorber Mar 26, 2021
97ad660
netlify test
slorber Mar 26, 2021
99974a4
netlify test
slorber Mar 26, 2021
670bda9
netlify test
slorber Mar 26, 2021
45694f0
netlify test
slorber Mar 26, 2021
77ab6b0
netlify test
slorber Mar 26, 2021
6194907
netlify test
slorber Mar 26, 2021
83e4758
netlify test
slorber Mar 26, 2021
594d82f
netlify test
slorber Mar 26, 2021
0f41a4b
fix existsSync() calls
slorber Mar 29, 2021
1dacd0b
replace @ts-nocheck by a temporary Webpack type
slorber Mar 29, 2021
bba7827
replace @ts-nocheck by a temporary Webpack type
slorber Mar 29, 2021
1254ba8
replace @ts-nocheck by a temporary Webpack type
slorber Mar 29, 2021
eab2b5b
migrate existing stats.warningsFilter to config.ignoreWarnings
slorber Mar 29, 2021
040ae94
remove stats from postBuild lifecycle data doc, as it is likely unuse…
slorber Mar 29, 2021
87f8d95
improve build.ts TS issues + move some sync code to async
slorber Mar 29, 2021
e51ce39
cleanup TS of start.ts
slorber Mar 29, 2021
a67220c
fix TS error
slorber Mar 29, 2021
a88ab06
fix TS issues
slorber Mar 29, 2021
a38617f
fix TS issues
slorber Mar 29, 2021
7fc0318
fix ts error
slorber Mar 29, 2021
89d4145
netlify test
slorber Mar 30, 2021
31ce3ba
netlify test
slorber Mar 30, 2021
0c28adf
netlify test
slorber Mar 30, 2021
b69618b
netlify test
slorber Mar 30, 2021
12e6bae
netlify test
slorber Mar 30, 2021
783f0e7
script cleanup
slorber Mar 30, 2021
c9bc610
script cleanup
slorber Mar 30, 2021
42f9026
re-enable @typescript-eslint/ban-ts-comment
slorber Mar 30, 2021
267f3e3
Deprecate getCacheLoader / getBabelLoader but keep retrocompatibility
slorber Mar 30, 2021
1871db8
useless TS
slorber Mar 30, 2021
aed7d60
fix and comment gca(chunkName) prefetching function
slorber Mar 30, 2021
915021f
remove deprecated mainTemplate.requireFn
slorber Mar 30, 2021
05cf1df
temporarily use react-loadable-ssr-addon-v5-slorber until PR merged: …
slorber Mar 30, 2021
abc6bbf
comment unsafeCache option
slorber Mar 30, 2021
18bac95
add explicit and more precise webpack targets
slorber Mar 30, 2021
42be951
splitChunks, use new type: "css/mini-extract" as it seems recommended…
slorber Mar 31, 2021
525e490
Merge branch 'master' into webpack-5
slorber Mar 31, 2021
0bb10d2
webpack error handling:
slorber Mar 31, 2021
c12041e
fix webpack5 warnings for evalSourceMapMiddleware.js
slorber Apr 1, 2021
3e773ba
typo
slorber Apr 1, 2021
4bc8f97
rename webpackHotDevClient
slorber Apr 1, 2021
aa137b4
make all modifications of react-dev-utils explicit with a comment
slorber Apr 1, 2021
48c03ba
revert LogPlugin adapter
slorber Apr 1, 2021
3cc6dc8
loader-utils update
slorber Apr 1, 2021
a34b514
add useful share cache comment
slorber Apr 1, 2021
ff391b7
add useful comments regarding the null-loader used in SSR for css files
slorber Apr 1, 2021
9c71697
upgrade webpack-merge in a retrocompatible way
slorber Apr 1, 2021
a142783
use MiniCssExtractPlugin.emit false as recommended
slorber Apr 1, 2021
ed4e0cd
use @docusaurus/responsive-loader
slorber Apr 2, 2021
f0524c0
revert MiniCssExtractPlugin esModule: false change
slorber Apr 2, 2021
a4bb878
add link to PR for custom CleanWebpackPlugin
slorber Apr 2, 2021
0f91f4a
pwa: add fallback to env variable or webpack 5 fails to build
slorber Apr 6, 2021
cb5550f
Merge branch 'master' into webpack-5
slorber Apr 16, 2021
81bcc36
upgrade to CssMinimizerPlugin 2.0
slorber Apr 16, 2021
68e8b8b
only build en locale for windows tests
slorber Apr 16, 2021
91f0c12
line breaks between errors
slorber Apr 16, 2021
bf5642d
add useful comment
slorber Apr 16, 2021
972cff4
Fix e2e tests with Yarn2 not finding new init template dependencies
slorber Apr 16, 2021
b305145
fix bad import
slorber Apr 16, 2021
e1b798a
disable browserslist target as webpack already tries to use browserli…
slorber Apr 16, 2021
a3c784f
webpack5 TS fixes
slorber Apr 17, 2021
351f1c5
fix getMinimizer order (even if it does not work yet)
slorber Apr 17, 2021
38ad2bf
update postcss to v8, fix cssnano minimizer errors
slorber Apr 18, 2021
adf2a52
Merge branch 'master' into webpack-5
slorber Apr 22, 2021
cafe2b4
add NavbarItem position to types (useful for QuestDB site upgrade to …
slorber Apr 27, 2021
46b1b82
Merge branch 'master' into webpack-5
slorber Apr 27, 2021
867d034
add webpack cache env variable to reduce risk of webpack 5 adoption
slorber Apr 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/v2-build-time-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
# Ensure build with a cold cache does not increase too much
- name: Build (cold cache)
run: yarn workspace docusaurus-2-website build
timeout-minutes: 10
timeout-minutes: 8

# Ensure build with a warm cache does not increase too much
- name: Build (warm cache)
run: yarn workspace docusaurus-2-website build
timeout-minutes: 10
timeout-minutes: 2

# TODO post a Github comment with build with perf warnings?
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@
"@formatjs/intl-datetimeformat": "^3.2.12",
"@formatjs/intl-numberformat": "^6.2.2",
"@formatjs/intl-pluralrules": "^4.0.11",
"@types/cssnano": "^4.0.0",
"@types/express": "^4.17.2",
"@types/fs-extra": "^9.0.6",
"@types/jest": "^26.0.20",
"@types/loader-utils": "^1.1.3",
"@types/loader-utils": "^2.0.1",
"@types/lodash": "^4.14.168",
"@types/node": "^14.14.22",
"@types/prismjs": "^1.16.2",
Expand All @@ -87,8 +88,7 @@
"@types/semver": "^7.1.0",
"@types/shelljs": "^0.8.6",
"@types/wait-on": "^5.2.0",
"@types/webpack": "^4.41.0",
"@types/webpack-dev-server": "^3.9.0",
"@types/webpack-dev-server": "^3.11.1",
"@types/webpack-merge": "^4.1.5",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-mdx-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"file-loader": "^6.2.0",
"fs-extra": "^9.1.0",
"github-slugger": "^1.3.0",
"loader-utils": "^2.0.0",
"gray-matter": "^4.0.2",
"mdast-util-to-string": "^2.0.0",
"remark-emoji": "^2.1.0",
"stringify-object": "^3.3.0",
"unist-util-visit": "^2.0.2",
"url-loader": "^4.1.1",
"webpack": "^4.44.1"
"webpack": "^5.28.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-alpha.72",
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-mdx-loader/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

const {getOptions} = require('loader-utils');
const {readFile} = require('fs-extra');
const mdx = require('@mdx-js/mdx');
const emoji = require('remark-emoji');
Expand All @@ -24,7 +23,8 @@ const DEFAULT_OPTIONS = {

module.exports = async function docusaurusMdxLoader(fileString) {
const callback = this.async();
const reqOptions = getOptions(this) || {};

const reqOptions = this.getOptions() || {};

const {frontMatter, content, hasFrontMatter} = readFrontMatter(
fileString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const createJSX = (node, pathUrl) => {
};

slorber marked this conversation as resolved.
Show resolved Hide resolved
async function ensureImageFileExist(imagePath, sourceFilePath) {
const imageExists = await fs.exists(imagePath);
const imageExists = await fs.pathExists(imagePath);
if (!imageExists) {
throw new Error(
`Image ${toMessageRelativeFilePath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const {
} = getFileLoaderUtils();

async function ensureAssetFileExist(fileSystemAssetPath, sourceFilePath) {
const assetExists = await fs.exists(fileSystemAssetPath);
const assetExists = await fs.pathExists(fileSystemAssetPath);
if (!assetExists) {
throw new Error(
`Asset ${toMessageRelativeFilePath(
Expand Down Expand Up @@ -85,12 +85,12 @@ async function convertToAssetLinkIfNeeded({node, staticDir, filePath}) {
toAssetLinkNode(fileSystemAssetPath);
} else if (path.isAbsolute(assetPath)) {
const fileSystemAssetPath = path.join(staticDir, assetPath);
if (await fs.exists(fileSystemAssetPath)) {
if (await fs.pathExists(fileSystemAssetPath)) {
toAssetLinkNode(fileSystemAssetPath);
}
} else {
const fileSystemAssetPath = path.join(path.dirname(filePath), assetPath);
if (await fs.exists(fileSystemAssetPath)) {
if (await fs.pathExists(fileSystemAssetPath)) {
toAssetLinkNode(fileSystemAssetPath);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-content-blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
"feed": "^4.2.2",
"fs-extra": "^9.1.0",
"globby": "^11.0.2",
"loader-utils": "^1.2.3",
"loader-utils": "^2.0.0",
"lodash": "^4.17.20",
"reading-time": "^1.3.0",
"remark-admonitions": "^1.2.1",
"tslib": "^2.1.0",
"webpack": "^4.44.1"
"webpack": "^5.28.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
9 changes: 4 additions & 5 deletions packages/docusaurus-plugin-content-blog/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
OptionValidationContext,
ValidationResult,
} from '@docusaurus/types';
import {Configuration, Loader} from 'webpack';
import {Configuration} from 'webpack';
import {
generateBlogFeed,
generateBlogPosts,
Expand Down Expand Up @@ -401,7 +401,7 @@ export default function pluginContentBlog(
configureWebpack(
_config: Configuration,
isServer: boolean,
{getBabelLoader, getCacheLoader}: ConfigureWebpackUtils,
{getJSLoader}: ConfigureWebpackUtils,
) {
const {
rehypePlugins,
Expand Down Expand Up @@ -441,8 +441,7 @@ export default function pluginContentBlog(
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
.map(addTrailingPathSeparator),
use: [
getCacheLoader(isServer),
getBabelLoader(isServer),
getJSLoader({isServer}),
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: {
Expand All @@ -466,7 +465,7 @@ export default function pluginContentBlog(
loader: path.resolve(__dirname, './markdownLoader.js'),
options: markdownLoaderOptions,
},
].filter(Boolean) as Loader[],
].filter(Boolean),
},
],
},
Expand Down
17 changes: 11 additions & 6 deletions packages/docusaurus-plugin-content-blog/src/markdownLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
* LICENSE file in the root directory of this source tree.
*/

import {loader} from 'webpack';
import {truncate, linkify} from './blogUtils';
import {parseQuery, getOptions} from 'loader-utils';
import {parseQuery} from 'loader-utils';
import {BlogMarkdownLoaderOptions} from './types';

const markdownLoader: loader.Loader = function (source) {
// TODO temporary until Webpack5 export this type
// see https://github.com/webpack/webpack/issues/11630
interface Loader extends Function {
(this: any, source: string): string | Buffer | void | undefined;
}

const markdownLoader: Loader = function (source) {
const filePath = this.resourcePath;
const fileString = source as string;
const callback = this.async();
const markdownLoaderOptions = getOptions(this) as BlogMarkdownLoaderOptions;
const markdownLoaderOptions = this.getOptions() as BlogMarkdownLoaderOptions;

// Linkify blog posts
let finalContent = linkify({
Expand All @@ -24,8 +29,8 @@ const markdownLoader: loader.Loader = function (source) {
});

// Truncate content if requested (e.g: file.md?truncated=true).
const truncated: string | undefined = this.resourceQuery
? parseQuery(this.resourceQuery).truncated
const truncated: boolean | undefined = this.resourceQuery
? !!parseQuery(this.resourceQuery).truncated
: undefined;

if (truncated) {
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
"fs-extra": "^9.1.0",
"globby": "^11.0.2",
"import-fresh": "^3.2.2",
"loader-utils": "^1.2.3",
"lodash": "^4.17.20",
"remark-admonitions": "^1.2.1",
"shelljs": "^0.8.4",
"tslib": "^2.1.0",
"utility-types": "^3.10.0",
"webpack": "^4.44.1"
"webpack": "^5.28.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {normalizePluginOptions} from '@docusaurus/utils-validation';
import {DocMetadata, LoadedVersion} from '../types';
import {toSidebarsProp} from '../props';

// @ts-expect-error: TODO typedefs missing?
import {validate} from 'webpack';

function findDocById(version: LoadedVersion, unversionedId: string) {
Expand Down Expand Up @@ -233,7 +232,7 @@ describe('simple website', () => {
false,
);
const errors = validate(config);
expect(errors.length).toBe(0);
expect(errors).toBeUndefined();
});

test('content', async () => {
Expand Down
20 changes: 8 additions & 12 deletions packages/docusaurus-plugin-content-docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export default function pluginContentDocs(
},

configureWebpack(_config, isServer, utils) {
const {getBabelLoader, getCacheLoader} = utils;
const {getJSLoader} = utils;
const {
rehypePlugins,
remarkPlugins,
Expand Down Expand Up @@ -349,8 +349,7 @@ export default function pluginContentDocs(
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
.map(addTrailingPathSeparator),
use: compact([
getCacheLoader(isServer),
getBabelLoader(isServer),
getJSLoader({isServer}),
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: {
Expand All @@ -375,16 +374,13 @@ export default function pluginContentDocs(
};
}

// Suppress warnings about non-existing of versions file.
const stats = {
warningsFilter: [VERSIONS_JSON_FILE],
};

return {
stats,
devServer: {
stats,
},
ignoreWarnings: [
// Suppress warnings about non-existing of versions file.
(e) =>
e.message.includes("Can't resolve") &&
e.message.includes(VERSIONS_JSON_FILE),
],
resolve: {
alias: {
'~docs': pluginDataDirRoot,
Expand Down
12 changes: 8 additions & 4 deletions packages/docusaurus-plugin-content-docs/src/markdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
* LICENSE file in the root directory of this source tree.
*/

import {getOptions} from 'loader-utils';
import {loader} from 'webpack';
import {linkify} from './linkify';
import {DocsMarkdownOption} from '../types';

const markdownLoader: loader.Loader = function (source) {
// TODO temporary until Webpack5 export this type
// see https://github.com/webpack/webpack/issues/11630
interface Loader extends Function {
(this: any, source: string): string | Buffer | void | undefined;
}

const markdownLoader: Loader = function (source) {
const fileString = source as string;
const callback = this.async();
const options = getOptions(this) as DocsMarkdownOption;
const options = this.getOptions() as DocsMarkdownOption;
return (
callback && callback(null, linkify(fileString, this.resourcePath, options))
);
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus-plugin-content-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
"@docusaurus/utils": "2.0.0-alpha.72",
"@docusaurus/utils-validation": "2.0.0-alpha.72",
"globby": "^11.0.2",
"loader-utils": "^1.2.3",
"lodash": "^4.17.20",
"minimatch": "^3.0.4",
"remark-admonitions": "^1.2.1",
"slash": "^3.0.0",
"tslib": "^2.1.0",
"webpack": "^4.44.1"
"webpack": "^5.28.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
9 changes: 4 additions & 5 deletions packages/docusaurus-plugin-content-pages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
ValidationResult,
ConfigureWebpackUtils,
} from '@docusaurus/types';
import {Configuration, Loader} from 'webpack';
import {Configuration} from 'webpack';
import admonitions from 'remark-admonitions';
import {PluginOptionSchema} from './pluginOptionSchema';
import {
Expand Down Expand Up @@ -192,7 +192,7 @@ export default function pluginContentPages(
configureWebpack(
_config: Configuration,
isServer: boolean,
{getBabelLoader, getCacheLoader}: ConfigureWebpackUtils,
{getJSLoader}: ConfigureWebpackUtils,
) {
const {
rehypePlugins,
Expand All @@ -214,8 +214,7 @@ export default function pluginContentPages(
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
.map(addTrailingPathSeparator),
use: [
getCacheLoader(isServer),
getBabelLoader(isServer),
getJSLoader({isServer}),
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: {
Expand Down Expand Up @@ -248,7 +247,7 @@ export default function pluginContentPages(
// contentPath,
},
},
].filter(Boolean) as Loader[],
].filter(Boolean),
},
],
},
Expand Down
11 changes: 7 additions & 4 deletions packages/docusaurus-plugin-content-pages/src/markdownLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
* LICENSE file in the root directory of this source tree.
*/

import {loader} from 'webpack';
// import {getOptions} from 'loader-utils';
// TODO temporary until Webpack5 export this type
// see https://github.com/webpack/webpack/issues/11630
interface Loader extends Function {
(this: any, source: string): string | Buffer | void | undefined;
}

const markdownLoader: loader.Loader = function (fileString) {
const markdownLoader: Loader = function (fileString) {
const callback = this.async();

// const options = getOptions(this);
// const options = this.getOptions();

// TODO provide additinal md processing here? like interlinking pages?
// fileString = linkify(fileString)
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-ideal-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"@docusaurus/lqip-loader": "2.0.0-alpha.72",
"@docusaurus/types": "2.0.0-alpha.72",
"@endiliey/react-ideal-image": "^0.0.11",
"@endiliey/responsive-loader": "^1.3.2",
"react-waypoint": "^9.0.2",
"responsive-loader-modern": "^1.3.2",
"sharp": "^0.27.1",
"tslib": "^2.1.0",
"webpack": "^4.44.1"
"webpack": "^5.28.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-ideal-image/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export default function (
use: [
require.resolve('@docusaurus/lqip-loader'),
{
loader: require.resolve('@endiliey/responsive-loader'),
loader: require.resolve('responsive-loader-modern'),
slorber marked this conversation as resolved.
Show resolved Hide resolved
options: {
emitFile: !isServer, // don't emit for server-side rendering
disable: !isProd,
// eslint-disable-next-line
adapter: require('@endiliey/responsive-loader/sharp'),
adapter: require('responsive-loader-modern/sharp'),
name: isProd
? 'assets/ideal-img/[name].[hash:hex:7].[width].[ext]'
: 'assets/ideal-img/[name].[width].[ext]',
Expand Down
Loading