-
Notifications
You must be signed in to change notification settings - Fork 44
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
Doesn't work in nuxt: Cannot use import statement outside a module #31
Comments
Same here, nuxt3, module throwing the same error |
Managed to make it work using nuxt3, if you you nuxt3 and need any further help let me know and ill share my solution |
Hi Schneider, |
Hey @vervelover components/Slider.vue <template>
<SliderComponent v-model="currentValues" />
</template>
<script lang="ts">
import SliderComponent from "@vueform/slider";
export default defineComponent({
components: {
SliderComponent, // This is required in order to use the component in the template context.
},
setup(props) {
// Your setup logic goes here
},
});
</script>
<style src="@vueform/slider/themes/default.css"></style>
<style scoped>
// custom css here
</style> nuxt.config.ts import { defineNuxtConfig } from "nuxt3";
export default defineNuxtConfig({
build: {
transpile: ["@vueform/slider"], // If you use nuxt you must transpile the module so it can be used universally
},
}); for me the caveat was the nuxt.config.ts, once i transpired it everything worked. Hope it will work to you as well |
Adding: build: {
transpile: ["@vueform/slider"], // If you use nuxt you must transpile the module so it can be used universally
}, to Nuxt config should work in both versions. |
Hi,
I'm trying to use your slider within a nuxt.js project, but I always get this error:
'Cannot use import statement outside a module'
Composition API is installed and working, can you try the latest stable version of nuxt and see if your instructions still work?
Thank you for your help,
Alessio
The text was updated successfully, but these errors were encountered: