Skip to content

Upgrade to NextJS 13 / MDX v2 / Tailwindcss v3 #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2456665
- Update Next.js to version 12
JiaeK Jan 4, 2023
24f612b
Merge branch 'rescript-association:master' into nextjs-12
JiaeK Jan 27, 2023
25d4a35
Updated NextJS to v.13
JiaeK Jan 27, 2023
5334930
Merge branch 'nextjs-12' of https://github.com/JiaeK/rescript-lang.or…
JiaeK Jan 27, 2023
90baa7a
Revert "Merge branch 'nextjs-12' of https://github.com/JiaeK/rescript…
JiaeK Jan 27, 2023
89c8df1
update
aspeddro Jul 30, 2023
66f65ad
update
aspeddro Jul 31, 2023
6929ff4
remove next-transpile-modules
aspeddro Jul 31, 2023
942f2c1
rm postcss
aspeddro Jul 31, 2023
20ad53b
back to html comments
aspeddro Jul 31, 2023
ae6de65
rm .md extension
aspeddro Jul 31, 2023
6fbe8ad
cleanup
aspeddro Jul 31, 2023
2add1d8
format
aspeddro Jul 31, 2023
0e1db89
fix next build
aspeddro Aug 2, 2023
59c00c4
comment extract-tocs for v9
aspeddro Aug 2, 2023
29a2d4b
move v9 docs to pages
aspeddro Aug 2, 2023
08b2e9f
remove v9 from gitignore
aspeddro Aug 2, 2023
be12e8f
Merge branch 'master' into nextjs-13-cont-aspeddro
aspeddro Aug 2, 2023
9cf8fa0
move page: mirate-from-v3 to migrate-react
aspeddro Aug 2, 2023
35c1ba2
update sidebar react section
aspeddro Aug 2, 2023
083f0c7
update rescript to 10.1.4
aspeddro Aug 2, 2023
6bff459
fix |
aspeddro Aug 2, 2023
001ee75
fix |
aspeddro Aug 3, 2023
1a7c319
remove expiremental next.config
aspeddro Aug 3, 2023
4d5d455
restore migrate-react pages
aspeddro Aug 3, 2023
4bb9028
remove import json
aspeddro Aug 3, 2023
e6c88d4
update packge-lock.json
aspeddro Aug 3, 2023
d0039ef
refactor
aspeddro Aug 3, 2023
985fcfe
remove mdx-loader and next-mdx plugins
aspeddro Aug 3, 2023
2414d21
fix parse block code
aspeddro Aug 3, 2023
f7d4b72
fix code block docs overview
aspeddro Aug 3, 2023
e9d378d
uncomment import-from-export-to-js.mdx
aspeddro Aug 3, 2023
90addb4
reduce diff
aspeddro Aug 3, 2023
de2d2d8
testing
aspeddro Oct 8, 2023
f821a1a
add v9
aspeddro Oct 8, 2023
57b45d6
adios require
aspeddro Oct 10, 2023
3621722
fix syntax lookup page
aspeddro Oct 11, 2023
0072541
Apply suggestions from code review
ryyppy Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
aspeddro committed Jul 31, 2023
commit 66f65ada56071ac7fe7595fb3e16fb4deea5cb86
2 changes: 1 addition & 1 deletion _blogposts/2021-02-09-release-9-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ReScript is a robustly typed language that compiles to efficient and human-reada

Use `npm` to install the newest [9.0.1 release](https://www.npmjs.com/package/bs-platform/v/9.0.1) with the following command:

```
```sh
npm install bs-platform@9.0.1
```

Expand Down
93 changes: 39 additions & 54 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,56 @@
// const { ProvidePlugin } = require("webpack");

// const bsconfig = require("./bsconfig.json");
// const remarkSlug = require("remark-slug");

import webpack from "webpack";
import rehypeSlug from 'rehype-slug';
import remarkGfm from 'remark-gfm';
import remarkComment from 'remark-comment';
import nextMDX from "@next/mdx";
import bsconfig from "./bsconfig.json" assert {type: 'json'};
import remarkFrontmatter from 'remark-frontmatter'
const transpileModules = ["rescript"].concat([
"@rescript/react",
"@ryyppy/rescript-promise"
]);
// const withTM = require("next-transpile-modules")(transpileModules);


import * as NextMdx from '@next/mdx'

// const withMdx = require("@next/mdx")({
// extension: /\.mdx?$/,
// options: {
// remarkPlugins: [remarkSlug],
// },
// });
const { ProvidePlugin } = webpack;
const transpileModules = ["rescript"].concat(bsconfig["bs-dependencies"]);

const withMDX = NextMdx.default({
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkFrontmatter], // ESM ✅
remarkPlugins: [remarkComment, remarkGfm, remarkFrontmatter],
providerImportSource: '@mdx-js/react',
rehypePlugins: []
rehypePlugins: [rehypeSlug]
},
});

const config = {
pageExtensions: ["jsx", "js", "bs.js", "mdx", "mjs"],
pageExtensions: ["jsx", "js", "bs.js", "mdx", "mjs", "md"],
env: {
ENV: process.env.NODE_ENV,
},
experimental: { esmExternals: 'loose' },
swcMinify: true,
// webpack: (config, options) => {
// const { isServer } = options;
// if (!isServer) {
// // We shim fs for things like the blog slugs component
// // where we need fs access in the server-side part
// config.resolve.fallback = {
// fs: false,
// path: false,
// };
// }
// // We need this additional rule to make sure that mjs files are
// // correctly detected within our src/ folder
// config.module.rules.push({
// test: /\.m?js$/,
// // v-- currently using an experimental setting with esbuild-loader
// //use: options.defaultLoaders.babel,
// use: [{ loader: "esbuild-loader", options: { loader: "jsx" } }],
// exclude: /node_modules/,
// type: "javascript/auto",
// resolve: {
// fullySpecified: false,
// },
// });
// config.plugins.push(new ProvidePlugin({ React: "react" }));
// return config;
// },
webpack: (config, options) => {
const { isServer } = options;
if (!isServer) {
// We shim fs for things like the blog slugs component
// where we need fs access in the server-side part
config.resolve.fallback = {
fs: false,
path: false,
};
}
// We need this additional rule to make sure that mjs files are
// correctly detected within our src/ folder
config.module.rules.push({
test: /\.m?js$/,
// v-- currently using an experimental setting with esbuild-loader
//use: options.defaultLoaders.babel,
use: [{ loader: "esbuild-loader", options: { loader: "jsx" } }],
exclude: /node_modules/,
type: "javascript/auto",
resolve: {
fullySpecified: false,
},
});
config.plugins.push(new ProvidePlugin({ React: "react" }));
return config;
},
async redirects() {
return [
{
Expand All @@ -77,11 +67,6 @@ const config = {
},
};

// module.exports = withMdx({
// transpilePackages: transpileModules,
// ...config,
// });

export default withMDX({
transpilePackages: transpileModules,
...config
Expand Down
Loading