-
Notifications
You must be signed in to change notification settings - Fork 16
/
craco.config.js
31 lines (28 loc) · 1.02 KB
/
craco.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// The reason we need to use CRACO is because MDX doesn't work with Create React App out of the box.
// https://github.com/orgs/mdx-js/discussions/1870
// https://github.com/orgs/mdx-js/discussions/2218
const { addAfterLoader, loaderByName } = require("@craco/craco");
module.exports = async env => {
const remarkGfm = (await import("remark-gfm")).default;
return {
webpack: {
configure: webpackConfig => {
addAfterLoader(webpackConfig, loaderByName("babel-loader"), {
test: /\.(md|mdx)$/,
loader: require.resolve("@mdx-js/loader"),
/** @type {import('@mdx-js/loader').Options} */
options: {
remarkPlugins: [remarkGfm]
}
});
return webpackConfig;
}
},
plugins: [
{ plugin: require("./craco-copy-webpack-plugin.js") },
{ plugin: require("./craco-fallback-util-plugin.js") },
{ plugin: require("./craco-service-worker-dev-plugin.js") },
{ plugin: require('react-app-alias').CracoAliasPlugin }
]
};
};