Merge pull request #8412 from storybookjs/7935-configure-module-check

Core: Check module type in configure
This commit is contained in:
Michael Shilman 2019-10-18 10:52:40 +08:00 committed by GitHub
commit 9fba9469b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -440,6 +440,11 @@ export default function start(render, { decorateStory } = {}) {
* @param {*} framework - name of framework in use, e.g. "react"
*/
const configure = (loadable, m, framework) => {
if (typeof m === 'string') {
throw new Error(
`Invalid module '${m}'. Did you forget to pass \`module\` as the second argument to \`configure\`"?`
);
}
if (m && m.hot && m.hot.dispose) {
({ previousExports = new Map() } = m.hot.data || {});