Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse failed: Unexpected token: import.meta #1295

Open
wJoenn opened this issue Aug 24, 2024 · 10 comments · Fixed by #1298
Open

Module parse failed: Unexpected token: import.meta #1295

wJoenn opened this issue Aug 24, 2024 · 10 comments · Fixed by #1298

Comments

@wJoenn
Copy link

wJoenn commented Aug 24, 2024

Environment

- Operating System: Linux
- Node Version:     v18.20.3
- Nuxt Version:     2.18.1
- CLI Version:      3.13.0
- Nitro Version:    2.9.7
- Package Manager:  [email protected]
- Builder:          webpack
- User Config:      bridge, build, modules, ssr, serverHandlers, devServerHandlers, devServer, typescript, nitro, buildModules
- Runtime Modules:  @pinia/[email protected]
- Build Modules:    (), @nuxt/[email protected]

Reproduction

https://stackblitz.com/edit/nuxt-bridge-reproduction?file=nuxt.config.ts

Describe the bug

As discussed in vuejs/pinia#2622 (comment), installing the latest version of @pinia/nuxt in a nuxt bridge project raises an error because import.meta is not parsable.

Reverting back to a version prior to the before-mentioned PR fixes the issue as it still uses process instead.

Additional context

👋 @danielroe

image

Some reasons for the settings in the reproduction:

Logs

No response

@wattanx
Copy link
Collaborator

wattanx commented Aug 27, 2024

We have checked that it works in the latest edge release.
@nuxt/[email protected]
https://stackblitz.com/edit/github-toccfh

@wJoenn
Copy link
Author

wJoenn commented Aug 27, 2024

Thank you both 🙌

@yshrsmz
Copy link

yshrsmz commented Sep 21, 2024

@wattanx hi, I still have the same problem.

It looks like your example does not contain @pinia/nuxt package.

Check the repro here: https://stackblitz.com/edit/github-toccfh-mifppg?file=package.json

@yshrsmz
Copy link

yshrsmz commented Sep 21, 2024

@wattanx Thanks for your quick reply!

When I run npx nuxi/@latest module add pinia as described in that instruction, I see @pinia/nuxt is installed and added to the dependencies. (and, I couldn't find any text that we don't need @pinia/nuxt for Nuxt Bridge)

Also, when I run your example(stackblitz.com/edit/github-toccfh), I see the warning log below. Is that ignorable?

WARN  Module @pinia/nuxt not found. Please ensure @pinia/nuxt is in dependencies and installed.    

@wattanx
Copy link
Collaborator

wattanx commented Sep 21, 2024

It was my mistake to say that installation is not necessary

@wJoenn
Copy link
Author

wJoenn commented Sep 22, 2024

@yshrsmz the fix has been merged but it hasn't been released yet.
Follow 3.4's PR #1261 if you wanna be notified about when it'll become available

@yshrsmz
Copy link

yshrsmz commented Sep 22, 2024

@wJoenn I've tested with @nuxt/[email protected] (the latest edge) and @nuxt/[email protected](the version wattanx mentioned), so I think I used the version which includes the change.

my repro is here: https://stackblitz.com/edit/github-toccfh-mifppg

Or did you confirm it's working as intended?

@wJoenn
Copy link
Author

wJoenn commented Sep 22, 2024

No my bad, I'm in mobile right now so I didn't take the time to check your repro. Sorry about that.

If edge doesn't work either then I suppose the fix doesn't work ?
I'll let Wattanx answer that

@yshrsmz
Copy link

yshrsmz commented Sep 28, 2024

@wattanx Sorry to bother you, but did you confirm the behavior? If my repro is correct, could you please reopen the issue? Or should I create another issue?

@wattanx wattanx reopened this Sep 28, 2024
@wattanx
Copy link
Collaborator

wattanx commented Sep 28, 2024

It seems that the issue hasn't been fixed, so I reopened it.
By the way, you can migrate to Nuxt 3 without migrating to Pinia if you use the following module
https://github.com/wattanx/nuxt-vuex-module
https://github.com/vedmant/nuxt3-vuex#nuxt3-vuex-module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants