docs(v2): wrap all plugin imports in require.resolve() (#2941)

* Wrap all plugin imports in require.resolve()

As per breaking change in 2.0.0-alpha0.56

* Wrap plugins in next version

* Revert "Wrap plugins in next version"

This reverts commit 5afa06e243.
This commit is contained in:
Tom Brien 2020-06-16 15:47:07 +01:00 committed by GitHub
parent 5b9f4dd0bb
commit e97d2eab5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,7 @@ Then you add it in your site's `docusaurus.config.js`'s `plugins` option:
```jsx {3} title="docusaurus.config.js" ```jsx {3} title="docusaurus.config.js"
module.exports = { module.exports = {
// ... // ...
plugins: ['@docusaurus/plugin-content-pages'], plugins: [require.resolve('@docusaurus/plugin-content-pages')],
}; };
``` ```
@ -44,7 +44,7 @@ module.exports = {
// ... // ...
plugins: [ plugins: [
[ [
'@docusaurus/plugin-xxx', require.resolve('@docusaurus/plugin-xxx'),
{ {
/* options */ /* options */
}, },
@ -59,7 +59,7 @@ Example:
module.exports = { module.exports = {
plugins: [ plugins: [
// Basic usage. // Basic usage.
'@docusaurus/plugin-google-analytics', require.resolve('@docusaurus/plugin-google-analytics'),
// With options object (babel style) // With options object (babel style)
[ [
@ -142,7 +142,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = { module.exports = {
plugins: [ plugins: [
[ [
'@docusaurus/plugin-content-blog', require.resolve('@docusaurus/plugin-content-blog'),
{ {
/** /**
* Path to data on filesystem relative to site dir. * Path to data on filesystem relative to site dir.
@ -226,7 +226,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = { module.exports = {
plugins: [ plugins: [
[ [
'@docusaurus/plugin-content-docs', require.resolve('@docusaurus/plugin-content-docs'),
{ {
/** /**
* Path to data on filesystem relative to site dir. * Path to data on filesystem relative to site dir.
@ -301,7 +301,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = { module.exports = {
plugins: [ plugins: [
[ [
'@docusaurus/plugin-content-pages', require.resolve('@docusaurus/plugin-content-pages'),
{ {
/** /**
* Path to data on filesystem * Path to data on filesystem
@ -341,7 +341,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
```js title="docusaurus.config.js" ```js title="docusaurus.config.js"
module.exports = { module.exports = {
plugins: ['@docusaurus/plugin-google-analytics'], plugins: [require.resolve('@docusaurus/plugin-google-analytics')],
themeConfig: { themeConfig: {
googleAnalytics: { googleAnalytics: {
trackingID: 'UA-141789564-1', trackingID: 'UA-141789564-1',
@ -372,7 +372,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
```js title="docusaurus.config.js" ```js title="docusaurus.config.js"
module.exports = { module.exports = {
plugins: ['@docusaurus/plugin-google-gtag'], plugins: [require.resolve('@docusaurus/plugin-google-gtag')],
themeConfig: { themeConfig: {
gtag: { gtag: {
trackingID: 'UA-141789564-1', trackingID: 'UA-141789564-1',
@ -403,7 +403,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = { module.exports = {
plugins: [ plugins: [
[ [
'@docusaurus/plugin-sitemap', require.resolve('@docusaurus/plugin-sitemap'),
{ {
cacheTime: 600 * 1000, // 600 sec - cache purge period cacheTime: 600 * 1000, // 600 sec - cache purge period
changefreq: 'weekly', changefreq: 'weekly',
@ -427,7 +427,7 @@ Modify your `docusaurus.config.js`
```diff ```diff
module.exports = { module.exports = {
... ...
+ plugins: ['@docusaurus/plugin-ideal-image'], + plugins: [require.resolve('@docusaurus/plugin-ideal-image')],
... ...
} }
``` ```