mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
chore(v2): upgrade to Babel 7 (#1012)
* Upgrade babel in v2 folder
* Use babel-plugin-transform-dynamic-import instead of babel-plugin-dynamic-import-node
* Remove not needed import polyfill by changing the order of import
* Revert "Remove not needed import polyfill by changing the order of import"
This reverts commit 9263aa693a
.
* Fix prettier
This commit is contained in:
parent
2e9656917c
commit
d052feec40
12 changed files with 727 additions and 472 deletions
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"presets": ["env", "react"]
|
||||
}
|
3
v2/babel.config.js
Normal file
3
v2/babel.config.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
presets: ['@babel/env', '@babel/react'],
|
||||
};
|
3
v2/jest.transform.js
Normal file
3
v2/jest.transform.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
const babelConfig = require('./babel.config');
|
||||
|
||||
module.exports = require('babel-jest').createTransformer(babelConfig);
|
|
@ -1,6 +1,6 @@
|
|||
import toSlug from './toSlug';
|
||||
|
||||
function anchors(md) {
|
||||
export default function anchors(md) {
|
||||
const originalRender = md.renderer.rules.heading_open;
|
||||
|
||||
// eslint-disable-next-line
|
||||
|
@ -18,5 +18,3 @@ function anchors(md) {
|
|||
return originalRender(tokens, idx, options, env);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = anchors;
|
||||
|
|
|
@ -51,8 +51,12 @@ module.exports = function createBaseConfig(props, isServer) {
|
|||
.loader('babel-loader')
|
||||
.options({
|
||||
babelrc: false,
|
||||
presets: ['env', 'react'],
|
||||
plugins: [isServer ? 'dynamic-import-node' : 'syntax-dynamic-import'],
|
||||
presets: ['@babel/env', '@babel/react'],
|
||||
plugins: [
|
||||
isServer
|
||||
? 'babel-plugin-transform-dynamic-import'
|
||||
: '@babel/syntax-dynamic-import',
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
"url": "https://github.com/facebook/Docusaurus/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-airbnb": "17.0.0",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
|
@ -42,12 +43,14 @@
|
|||
"prettier": "^1.13.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.5",
|
||||
"babel-plugin-dynamic-import-node": "^2.0.0",
|
||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/polyfill": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-loader": "^8.0.0",
|
||||
"babel-plugin-transform-dynamic-import": "^2.1.0",
|
||||
"chalk": "^2.4.1",
|
||||
"chokidar": "^2.0.4",
|
||||
"classnames": "^2.2.6",
|
||||
|
|
|
@ -8,5 +8,8 @@ module.exports = {
|
|||
moduleNameMapper: {
|
||||
'^@lib/(.*)$': '<rootDir>/lib/$1',
|
||||
},
|
||||
testPathIgnorePatterns: ['/node_modules/', '__fixtures__'],
|
||||
testPathIgnorePatterns: ['/node_modules/', '__fixtures__', 'v1'],
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/jest.transform.js',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import '@babel/polyfill';
|
||||
import path from 'path';
|
||||
import loadDocs from '@lib/load/docs';
|
||||
import loadSetup from '../../loadSetup';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import '@babel/polyfill';
|
||||
import path from 'path';
|
||||
import processMetadata from '@lib/load/docs/metadata';
|
||||
import loadSetup from '../../loadSetup';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import '@babel/polyfill';
|
||||
import path from 'path';
|
||||
import load from '@lib/load';
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import '@babel/polyfill';
|
||||
import {validate} from 'webpack';
|
||||
import path from 'path';
|
||||
import Config from 'webpack-chain';
|
||||
|
|
1154
v2/yarn.lock
1154
v2/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue