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

Errors using bundled component #287

Open
Tommytrg opened this issue Jan 12, 2020 · 0 comments
Open

Errors using bundled component #287

Tommytrg opened this issue Jan 12, 2020 · 0 comments

Comments

@Tommytrg
Copy link

Tommytrg commented Jan 12, 2020

Hello!

I'm using bili to bundle a typescript vue component. I've bundled it but its behavior is not the expected and it's throwing these warnings when it renders:

[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "messages"
[Vue warn]: $attrs is readonly.

I'm installing the library just like that:

src/plugins/vue-simplet-chat.js

import Vue from 'vue'
import Chat from 'vue-simple-chat'

Vue.use(Chat)

And then importing it in my main.js file like the other external components: import './plugins/vue-simple-chat.js'

On the other hand, I'm running this command to generate the bundle:

yarn bili --format umd,cjs,iife,esm --module-name VueSimpleChat

bili.config.ts

module.exports = {
  output: {
    extractCSS: false,
  },
  input: 'src/index.ts',
  plugins: {
    vue: {
      css:false
    }
  }
}

The entry point is the src/index.ts file:

src/index.ts

import Chat from './Chat.vue'

export default {
 install(Vue: any, options: any) {
  Vue.component("vue-simple-chat", Chat);
 }
}

AFAIK, those errors appear when are multiple vue instances. Am I doing something wrong in my build step or when I import the component in a project?

Thank you in advance! 😅

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

No branches or pull requests

1 participant