Error: Cannot find module 'stoppable'
Khalilsqu opened this issue · 5 comments
This looks unrelated to Perspective. Post full source code please.
Hi, @Khalilsqu. I encountered the same problem. Looks like the latest upgrade (v2.0.0) of Perspective introduced a new dependency. Try npm i -D stoppable
and put it in your webpack plugin custom config:
webpackConfig.resolve.fallback = {
stoppable: require.resolve('stoppable')
};
This helped me resolve this issue.
@yangjunhan thanks for the help. However, I am not exactly aware how to configure webpack! where does it go?
is this how is it? next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: (config, options) => {
config.resolve.fallback = {
stoppable: require.resolve("stoppable"),
};
return config;
},
};
module.exports = nextConfig;
- Next JS app
@Khalilsqu This is not an adequate repro. I don't know even which version of the library you are trying to import - webpack
and the perspective module that imports stoppable
(node.js) are mutually exclusive AFAIK.
This dependency does look like its missing so I'll add it, but as you've provided no repro I can't verify it does anything for you, so closing. Please use the error template and provide as much detail as possible when you file issues in the future.
@texodus , I have been able to replicate simply by upgrading to Perspective 2.2.1 in a deployment that was working fine on 1.9.4. Please see pull request here: riziles/svelte-perspective-starter1#2 the Vercel preview deployments show server errors. The log files all point to the missing stoppable
dependency.
FWIW, I'm using Vite (via SvelteKit), not Webpack. Installing stoppable
resolves the issue without having to alter any config files.