Commit 8c5e85d4 authored by Felix Mosheev's avatar Felix Mosheev Committed by Tim Neutkens

Check if dynamicOptions has the deprecated `method` property, (#7973)

* Check if dynamicOptions has the deprecated `method` property, closes #7972

* Update dynamic.tsx
parent 8e467bee
......@@ -120,11 +120,15 @@ export default function dynamic<P = {}>(
typeof dynamicOptions === 'object' &&
!(dynamicOptions instanceof Promise)
) {
if (process.env.NODE_ENV !== 'production') {
// show deprecation warning in development
console.warn(
'The modules option for next/dynamic has been deprecated. See here for more info https://err.sh/zeit/next.js/next-dynamic-modules'
)
// show deprecation warning for `modules` key in development
if (
process.env.NODE_ENV !== 'production'
) {
if(dynamicOptions.modules) {
console.warn(
'The modules option for next/dynamic has been deprecated. See here for more info https://err.sh/zeit/next.js/next-dynamic-modules'
)
}
}
// Support for `render` when using a mapping, eg: `dynamic({ modules: () => {return {HelloWorld: import('../hello-world')}, render(props, loaded) {} } })
if (dynamicOptions.render) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment