JonasKruckenberg / imagetools

Load and transform images using a toolbox :toolbox: of custom import directives!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find module 'imagetools-core' with Vite 4

GimpMaster opened this issue · comments

 ERROR  error when starting dev server:                                                                                                                                          14:27:49
Error: Cannot find module 'imagetools-core'
Require stack:
- /home/dev/marketing-site-v2/node_modules/vite-imagetools/dist/index.cjs
- /home/dev/marketing-site-v2/vite.config.ts
- /home/dev/marketing-site-v2/node_modules/vite/dist/node/chunks/dep-0bae2027.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)

I just tried updating to latest Vite 4 with latest vite-imagetools. I received the error message above. Any suggestions?

Node 14 LTS
Vite 4.0.3
vite-imagetools: 4.0.12

Here is vite.config.ts

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { createHtmlPlugin } from 'vite-plugin-html';
import ViteCSSExportPlugin from 'vite-plugin-css-export';
import { imagetools } from 'vite-imagetools';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
	let isDebug = mode === 'debug';

	return {
		plugins: [
			react(),
			createHtmlPlugin({
				minify: true,
				entry: '/src/index.tsx',
				template: 'public/index.html'
			}),
			ViteCSSExportPlugin(),
			imagetools()
		],
		css: {
			// Adds Source Maps when viewing SCSS in dev mode
			devSourcemap: true
		},
		build: {
			...(isDebug && { sourcemap: true }),
			...(isDebug && { minify: false }),
			outDir: 'build'
		},
		server: {
			// Uncomment when using ngrok, but comment back when NOT. See this post: https://github.com/vitejs/vite/discussions/5399
			// hmr: { clientPort: 443 },
			proxy: {
				
			}
		}
	};
});

Actually I see this issue in any version of vite. If I hard fix the version at 4.0.11 I no longer see the issue. Was imagetools-core a new required dependency?

This should be independent of the vote version and is something I think got introduced by #452 and should be reverted by #457 I think? Maybe @benmccann can shed some more light on this

Hopefully #457 would fix it. @JonasKruckenberg are you okay if we merge that one and could you cut a new release afterwards?

I updated it somewhat and did indeed merge it now, doing some last upgrades for the release workflow (bc I realised we weren't using the proper action, but some whacky homegrown stuff) so hopefully both fixes together make this be gone for good

Awesome! Thanks both of you. Looking forward to trying new version.

Looks like it works for me now with the release published just a few secs ago

Confirmed. Works for me! Closing Issue