variantjs/vue

Critical dependency

iamroi opened this issue ยท 8 comments

I followed the documentation and tried to use it on a fresh Laravel Jetstream Inertia project but getting this error below

WARNING in ./node_modules/@variantjs/vue/dist/index.es.js 1:442-449
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

all I did was import { variantJS } from '@variantjs/vue';

Any help would be appreciated!

I am not entirely sure what can cause that issue but just fixed a patch (for another issue) that may be related, can you please upgrade to 0.0.7 and try again?

@alfonsobries I just upgraded to 0.0.9 and no luck yet :(

@alfonsobries I found that one of the line in dist file index.es.js causing the issue screenshot

Hope this will help pinpointing the issue!

I got this error too, though the functionality still works.

After diving through many places, still no luck.
But I think this 5 years old post maybe can give us some hints:
https://www.reddit.com/r/typescript/comments/4q09uv/help_webpack_weirdness_require_function_is_used/

It was suggesting to use "commonjs" for module value in tsconfig.js. However, when I test to change this value, the build shows warning related to rollup plugin @rollup/plugin-typescript, and it still can't work.

thanks, @stephenkhoo will take a look at the error this week (maybe even tonight), since happens in a fresh laravel installation should be relatively easy to replicate cc @iamroi

To give extra context, I've tried with vue-cli created project (both with and without add typescript), they both having the same Critical dependency warning.

All the best!

@stephenkhoo @iamroi the error should be fixed on ^0.0.10

feel free to open this ticket again if it doesnt work

Thank you @alfonsobries 0.0.10 solved it :)