Skip to content

Commit

Permalink
feat: allow for Typescript pages and components
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanrdelgado committed Jan 16, 2020
1 parent 68035cc commit e5c9c8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-pages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {PluginOptions, LoadedContent} from './types';
const DEFAULT_OPTIONS: PluginOptions = {
path: 'src/pages', // Path to data on filesystem, relative to site dir.
routeBasePath: '', // URL Route.
include: ['**/*.{js,jsx}'], // Extensions to include.
include: ['**/*.{js,jsx,ts,tsx}'], // Extensions to include.
};

export default function pluginContentPages(
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function objectWithKeySorted(obj: Object) {
.value();
}

const indexRE = /(^|.*\/)index\.(md|js)$/i;
const indexRE = /(^|.*\/)index\.(md|js|jsx|ts|tsx)$/i;
const extRE = /\.(md|js)$/;

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus/src/webpack/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function createBaseConfig(
},
devtool: isProd ? false : 'cheap-module-eval-source-map',
resolve: {
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
symlinks: true,
alias: {
// https://stackoverflow.com/a/55433680/6072730
Expand Down Expand Up @@ -146,7 +147,7 @@ export function createBaseConfig(
module: {
rules: [
{
test: /\.jsx?$/,
test: /\.(j|t)sx?$/,
exclude: excludeJS,
use: [getCacheLoader(isServer), getBabelLoader(isServer)].filter(
Boolean,
Expand Down

0 comments on commit e5c9c8f

Please sign in to comment.