fix(v2): revert webpack.resolve.symlinks = false (#5164)

* WathcOptions should work even if Webpack does not resolve symlinks

* re-enable webpack resolve.symlinks = true

* Use symlinked folder as source
This commit is contained in:
Sébastien Lorber 2021-07-13 20:11:08 +02:00 committed by GitHub
parent f33cd079c2
commit d3764f77fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View file

@ -185,8 +185,12 @@ export default async function start(
},
publicPath: baseUrl,
watchOptions: {
ignored: /node_modules/,
poll: cliOptions.poll,
// Useful options for our own monorepo using symlinks!
// See https://github.com/webpack/webpack/issues/11612#issuecomment-879259806
followSymlinks: true,
ignored: /node_modules\/(?!@docusaurus)/,
},
historyApiFallback: {
rewrites: [{from: /\/*/, to: baseUrl}],

View file

@ -139,7 +139,7 @@ export function createBaseConfig(
resolve: {
unsafeCache: false, // not enabled, does not seem to improve perf much
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
symlinks: false, // disabled on purpose (https://github.com/facebook/docusaurus/issues/3272)
symlinks: true, // see https://github.com/facebook/docusaurus/issues/3272
roots: [
// Allow resolution of url("/fonts/xyz.ttf") by webpack
// See https://webpack.js.org/configuration/resolve/#resolveroots

View file

@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
const fs = require('fs');
const path = require('path');
const versions = require('./versions.json');
const math = require('remark-math');
@ -121,10 +122,11 @@ const isVersioningDisabled = !!process.env.DISABLE_VERSIONING || isI18nStaging;
{
// This plugin instance is used to test fancy edge cases
id: 'docs-tests',
// Using a symlinked folder as source, test against https://github.com/facebook/docusaurus/issues/3272
path: 'dogfooding/docs-tests-symlink',
routeBasePath: 'docs-tests',
sidebarPath: 'dogfooding/docs-tests-sidebars.js',
// Using a symlinked folder as source, test for use-case https://github.com/facebook/docusaurus/issues/3272
path: fs.realpathSync('dogfooding/docs-tests-symlink'),
},
],