-
-
Notifications
You must be signed in to change notification settings - Fork 147
Error when importing javascript modules (ViteJs?) #68
Comments
@libero-software I have the same issue but only with |
@libero-software Same issue here. I just migrated from Laravel Mix to Vite. Before it worked. |
The problem is the: If you remove this, the table will render in vitejs's 'yarn run dev'. But the table won't work, because 'stringify' is used from the 'qs' package. |
I just had the same problem. Has anyone found a solution? |
I can see in the repo that a version 2.0 is being developed with ViteJs. This will probably solve the problem. @pascalbaljet Do you have a release date in mind? Thanks! |
Vite doesnt support module.exports {} / require(), only export default {} / import .. from .. (ES6 syntax) Vite caches node_modules in node_modules/.vite. Rerunning npm run dev does not clear this cache. Steps I took to work around this problem are as follows: node_modules/qs/index.js replace content with:
node_modules/qs/formats.jsreplace line 11
with
node_modules/qs/utils.jsreplace line 3
with
replace line 241
with
node_modules/qs/parse.jsreplace line 3
with
replace line 239
with
node_modules/qs/stringify.jsreplace line 3
with
replace line 4,5
with
replace line 241
with
replace line 169
with
replace line 285
with
After changing the lines remove the node_modules/.vite folder and run npm run dev. getSideChannel contains code or leads to code that that currently cannot easily or will not be changed to ES6 syntax. Edited: after some time (idle) parse.js also throws an error, so also change parse.js Maybe urlsearchparameters could be used instead of qs in the next version? weakmap and urlsearchparameters can both be polyfilled |
It's fixed in v2, but I'll try to backport the fix to v1. |
Great, thanks! When are you planning to release V2? |
V2 has been released, but is also breaks on production builds... |
Using Laravel 9 (jetstream), Inertia.js, Vue3, ViteJs.
I used this package before, and got it working. The main difference now is that i use ViteJS. Not sure if this is related.
I get the following error when importing this (nice) package:
Uncaught (in promise) SyntaxError: The requested module '/node_modules/qs/lib/index.js?v=57eb2887' does not provide an export named 'default' (at InteractsWithQueryBuilder.vue:2:8)
I`m using the example from de documentation:
Am i doing something wrong or is this a bug?
The text was updated successfully, but these errors were encountered: