mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
feat(v2): allow for TypeScript pages and components (#2221)
This commit is contained in:
parent
f2137bb872
commit
5cb3309790
3 changed files with 4 additions and 3 deletions
|
@ -16,7 +16,7 @@ import {PluginOptions, LoadedContent} from './types';
|
||||||
const DEFAULT_OPTIONS: PluginOptions = {
|
const DEFAULT_OPTIONS: PluginOptions = {
|
||||||
path: 'src/pages', // Path to data on filesystem, relative to site dir.
|
path: 'src/pages', // Path to data on filesystem, relative to site dir.
|
||||||
routeBasePath: '', // URL Route.
|
routeBasePath: '', // URL Route.
|
||||||
include: ['**/*.{js,jsx}'], // Extensions to include.
|
include: ['**/*.{js,jsx,ts,tsx}'], // Extensions to include.
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function pluginContentPages(
|
export default function pluginContentPages(
|
||||||
|
|
|
@ -60,7 +60,7 @@ export function objectWithKeySorted(obj: Object) {
|
||||||
.value();
|
.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
const indexRE = /(^|.*\/)index\.(md|js)$/i;
|
const indexRE = /(^|.*\/)index\.(md|js|jsx|ts|tsx)$/i;
|
||||||
const extRE = /\.(md|js)$/;
|
const extRE = /\.(md|js)$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,6 +56,7 @@ export function createBaseConfig(
|
||||||
},
|
},
|
||||||
devtool: isProd ? false : 'cheap-module-eval-source-map',
|
devtool: isProd ? false : 'cheap-module-eval-source-map',
|
||||||
resolve: {
|
resolve: {
|
||||||
|
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
|
||||||
symlinks: true,
|
symlinks: true,
|
||||||
alias: {
|
alias: {
|
||||||
// https://stackoverflow.com/a/55433680/6072730
|
// https://stackoverflow.com/a/55433680/6072730
|
||||||
|
@ -146,7 +147,7 @@ export function createBaseConfig(
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.jsx?$/,
|
test: /\.(j|t)sx?$/,
|
||||||
exclude: excludeJS,
|
exclude: excludeJS,
|
||||||
use: [getCacheLoader(isServer), getBabelLoader(isServer)].filter(
|
use: [getCacheLoader(isServer), getBabelLoader(isServer)].filter(
|
||||||
Boolean,
|
Boolean,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue