@next/mdx 15.0.4-canary.16 → 15.0.4-canary.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +27 -22
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module.exports =
|
|
2
2
|
(pluginOptions = {}) =>
|
|
3
|
-
(
|
|
3
|
+
(inputConfig = {}) => {
|
|
4
4
|
const extension = pluginOptions.extension || /\.mdx$/
|
|
5
5
|
const userProvidedMdxOptions = pluginOptions.options
|
|
6
6
|
|
|
7
|
-
const mdxRsOptions =
|
|
7
|
+
const mdxRsOptions = inputConfig?.experimental?.mdxRs
|
|
8
8
|
const loader = mdxRsOptions
|
|
9
9
|
? {
|
|
10
10
|
loader: require.resolve('./mdx-rs-loader'),
|
|
@@ -23,8 +23,28 @@ module.exports =
|
|
|
23
23
|
},
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
let nextConfig = Object.assign({}, inputConfig, {
|
|
27
|
+
webpack(config, options) {
|
|
28
|
+
config.resolve.alias['next-mdx-import-source-file'] = [
|
|
29
|
+
'private-next-root-dir/src/mdx-components',
|
|
30
|
+
'private-next-root-dir/mdx-components',
|
|
31
|
+
'@mdx-js/react',
|
|
32
|
+
]
|
|
33
|
+
config.module.rules.push({
|
|
34
|
+
test: extension,
|
|
35
|
+
use: [options.defaultLoaders.babel, loader],
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
if (typeof inputConfig.webpack === 'function') {
|
|
39
|
+
return inputConfig.webpack(config, options)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return config
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
if (process.env.TURBOPACK) {
|
|
47
|
+
nextConfig.experimental = Object.assign({}, nextConfig?.experimental, {
|
|
28
48
|
turbo: Object.assign({}, nextConfig?.experimental?.turbo, {
|
|
29
49
|
rules: Object.assign({}, nextConfig?.experimental?.turbo?.rules, {
|
|
30
50
|
'*.mdx': {
|
|
@@ -41,23 +61,8 @@ module.exports =
|
|
|
41
61
|
}
|
|
42
62
|
),
|
|
43
63
|
}),
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
config.resolve.alias['next-mdx-import-source-file'] = [
|
|
47
|
-
'private-next-root-dir/src/mdx-components',
|
|
48
|
-
'private-next-root-dir/mdx-components',
|
|
49
|
-
'@mdx-js/react',
|
|
50
|
-
]
|
|
51
|
-
config.module.rules.push({
|
|
52
|
-
test: extension,
|
|
53
|
-
use: [options.defaultLoaders.babel, loader],
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
if (typeof nextConfig.webpack === 'function') {
|
|
57
|
-
return nextConfig.webpack(config, options)
|
|
58
|
-
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
})
|
|
67
|
+
return nextConfig
|
|
63
68
|
}
|