Skip to content

Commit b2e5493

Browse files
committedNov 17, 2020
clearer error when plugin is missing
1 parent 9007be0 commit b2e5493

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed
 

‎src/utils/errors.ts

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const errors = {
2929
18(plugin: string) {
3030
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`
3131
},
32-
19: "plugin not loaded",
3332
20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",
3433
21(thing: string) {
3534
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`

‎src/utils/plugins.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function getPlugin<K extends keyof Plugins>(
5252
): Exclude<Plugins[K], undefined> {
5353
const plugin = plugins[pluginKey]
5454
if (!plugin) {
55-
die(__DEV__ ? 18 : 19, pluginKey)
55+
die(18, pluginKey)
5656
}
5757
// @ts-ignore
5858
return plugin

0 commit comments

Comments
 (0)
Please sign in to comment.