@next/mdx 15.5.3 → 15.6.0-canary.0
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 +32 -16
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -26,7 +26,8 @@ module.exports =
|
|
|
26
26
|
/**
|
|
27
27
|
* @type {import('next').NextConfig}
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
const nextConfig = {
|
|
30
|
+
...inputConfig,
|
|
30
31
|
webpack(config, options) {
|
|
31
32
|
config.resolve.alias['next-mdx-import-source-file'] = [
|
|
32
33
|
'private-next-root-dir/src/mdx-components',
|
|
@@ -45,26 +46,41 @@ module.exports =
|
|
|
45
46
|
|
|
46
47
|
return config
|
|
47
48
|
},
|
|
48
|
-
}
|
|
49
|
+
}
|
|
49
50
|
|
|
50
51
|
if (process.env.TURBOPACK) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
conditions: {
|
|
59
|
-
'#next-mdx': {
|
|
60
|
-
path: extension,
|
|
61
|
-
},
|
|
52
|
+
const mdxRule = {
|
|
53
|
+
loaders: [loader],
|
|
54
|
+
as: '*.tsx',
|
|
55
|
+
condition: {
|
|
56
|
+
path: extension,
|
|
62
57
|
},
|
|
63
|
-
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Use a unique glob string for two reasons:
|
|
61
|
+
// - This makes it clear where the rule was defined if someone needs to debug.
|
|
62
|
+
// - Reduces the chance of a collision (can still happen if `next-mdx` is applied twice with
|
|
63
|
+
// different options). Rule evaluation is ordering-sensitive, and a unique glob means we're
|
|
64
|
+
// less likely to break the ordering of existing rules.
|
|
65
|
+
let wildcardGlob = '{*,next-mdx-rule}'
|
|
66
|
+
let wildcardRule = inputConfig.turbopack?.rules?.[wildcardGlob] ?? []
|
|
67
|
+
wildcardRule = [
|
|
68
|
+
...(Array.isArray(wildcardRule) ? wildcardRule : [wildcardRule]),
|
|
69
|
+
mdxRule,
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
nextConfig.turbopack = {
|
|
73
|
+
...inputConfig?.turbopack,
|
|
74
|
+
rules: {
|
|
75
|
+
...inputConfig?.turbopack?.rules,
|
|
76
|
+
[wildcardGlob]: wildcardRule,
|
|
77
|
+
},
|
|
78
|
+
resolveAlias: {
|
|
79
|
+
...inputConfig?.turbopack?.resolveAlias,
|
|
64
80
|
'next-mdx-import-source-file':
|
|
65
81
|
'@vercel/turbopack-next/mdx-import-source',
|
|
66
|
-
}
|
|
67
|
-
}
|
|
82
|
+
},
|
|
83
|
+
}
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
return nextConfig
|