forked from RobinCsl/gatsby-starter-docz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoczrc.js
41 lines (39 loc) · 1.46 KB
/
doczrc.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
32
33
34
35
36
37
38
39
40
41
import merge from 'webpack-merge'
import { css } from 'docz-plugin-css'
export default {
title: 'Docz with Gatsby',
// Add CSS support in case you use them in your Gatsby project
plugins: [css()],
// Wrapper used to inject some global variable mocks
wrapper: 'docz/wrapper.js',
modifyBundlerConfig: config => {
const gatsbyNecessaryConfig = {
module: {
rules: [
{
// Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
// Ignore .json files because they fail to be parsed
exclude: [/node_modules\/(?!(gatsby)\/)/, /\.json$/],
use: [
{
// use installed babel-loader which is v8.0-beta (which is meant to work with @babel/core@7)
loader: 'babel-loader',
options: {
// use @babel/preset-react for JSX and env (instead of staged presets)
presets: ['@babel/preset-react', '@babel/preset-env'],
plugins: [
// use @babel/plugin-proposal-class-properties for class arrow functions
'@babel/plugin-proposal-class-properties',
// use @babel/plugin-syntax-dynamic-import for dynamic import support
'@babel/plugin-syntax-dynamic-import',
],
},
},
],
},
],
},
}
return merge(gatsbyNecessaryConfig, config)
},
}