Skip to content

Use shim in nuxt report an error when build #149

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

Closed
Ttou opened this issue Jul 26, 2021 · 10 comments
Closed

Use shim in nuxt report an error when build #149

Ttou opened this issue Jul 26, 2021 · 10 comments
Assignees

Comments

@Ttou
Copy link

Ttou commented Jul 26, 2021

nuxt: 2.15.7
vue-types: 4.0.0
repo: link

微信截图_20210726161026

@dwightjack
Copy link
Owner

dwightjack commented Jul 26, 2021

Hello,

I am not completely sure why this is happening. You could try to configure the build following instructions for webpack 5 (use vue-types/shim as the path to shim).

Also, could you share the part of configuration where you set the shim?

@dwightjack dwightjack self-assigned this Jul 26, 2021
@Ttou
Copy link
Author

Ttou commented Jul 26, 2021

@dwightjack webpack 5 is fine, nuxt is using webpack4

@Ttou
Copy link
Author

Ttou commented Jul 27, 2021

@dwightjack you mean use webpack5 config instead?

@dwightjack
Copy link
Owner

The build behavior is strange. Nuxt still uses webpack 4 but the behaviour reported in the error suggests that the tool is trying to load vue-types like webpack 5 does.

I've created a demo installation and I cannot replicate the issue: https://github.com./dwightjack/demo-nuxt-vue-types

Re you using any particular setup (for example: nuxt-ts?).

@Ttou
Copy link
Author

Ttou commented Jul 27, 2021

@dwightjack online example

@dwightjack
Copy link
Owner

@Ttou so the issue might be related to the version of node you're using.

When setting the shim alias try one of the following:

'vue-types': 'vue-types/shim'

or

'vue-types': require.resolve('vue-types/shim')

I will update the docs in the next few days.

@Ttou
Copy link
Author

Ttou commented Jul 27, 2021

another issue, when using custom validator, report error:
微信截图_20210727173017

@dwightjack
Copy link
Owner

I see.

That's another issue I already found and was going to fix in the next few days.

Sorry for the problem, for now please don't use the shim. I will inform you as soon as the issue is fixed 🙇

@dwightjack
Copy link
Owner

@Ttou I've published a first patch that should fix your issue in [email protected].

Let me know if it works.

@Ttou
Copy link
Author

Ttou commented Jul 28, 2021

@dwightjack fixed

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

No branches or pull requests

2 participants