This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Fails with commonjs file (vite.config.ts) #7
Comments
It works with async define config in vite and async import. Not a nice solution but it seems to work import { defineConfig } from 'vite'
export default defineConfig(async ({ command, mode }) => {
const sri = await import('@small-tech/vite-plugin-sri')
return {
plugins: [sri.default()]
}
}) |
Ok so would need that module filed in the package.json, which is not included in the vite-> vue template https://bobbyhadz.com/blog/javascript-error-err-require-esm-require-of-es-module-not-supported |
Please publish the current codebase on npm. In the npm version is no cjs file and no exports property in the package.json |
I'm getting this same error as well 😭
|
need to add support for typescript |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
i used the codelines from your readme.md in my vite.config.ts file. This happens when i triy to build:
failed to load config from ...\vite.config.ts error during build: Error [ERR_REQUIRE_ESM]: require() of ES Module ...\node_modules\@small-tech\vite-plugin-sri\index.js from ...\vite.config.ts not supported. Instead change the require of index.js in c:\Dev\Try\my-vue-appts\vite.config.ts to a dynamic import() which is available in all CommonJS modules.
When i try to use require instead of import:
failed to load config from ...\vite.config.ts error during build: Error [ERR_REQUIRE_ESM]: require() of ES Module ...\node_modules\@small-tech\vite-plugin-sri\index.js from ...\vite.config.ts not supported. Instead change the require of index.js in c:\Dev\Try\my-vue-appts\vite.config.ts to a dynamic import() which is available in all CommonJS modules.
Can you please build the library in a way i can be imported?
The text was updated successfully, but these errors were encountered: