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

Cannot read property 'call' of undefined #2551

Closed
RhysXia opened this issue Jan 10, 2018 · 14 comments
Closed

Cannot read property 'call' of undefined #2551

RhysXia opened this issue Jan 10, 2018 · 14 comments
Labels

Comments

@RhysXia
Copy link

RhysXia commented Jan 10, 2018

When I use the nuxt1.0.0 and the nuxt.config.js with extractCSS: true, if I start my project in env mode, it will log the Cannot read property 'call' of undefined in bowser console.

With my trying, I find it is OK if I set below

extractCSS: {
    allChunks: true
}

I think it may be a bug,so I report it.
Think you.

This bug report is available on Nuxt.js community (#c2219)
@clarkdo
Copy link
Member

clarkdo commented Jan 11, 2018

Can you provider the repo?

@RhysXia
Copy link
Author

RhysXia commented Jan 12, 2018

I'm sorry. I thought about this problem again yesterday. I found it wasn't the extractCss problem. It's the problem of my plugin. this is my plugin below

import Vue from 'vue'
import CRow from '~/components/grid/row'
import CCol from '~/components/grid/col'
import Message from '~/components/common/message'

export default () => {
  Vue.component('CRow', CRow)
  Vue.component('CCol', CCol)

  Vue.prototype.$message = Message
}

In the nuxt.config.js, I add the plugin to vendor, then the problem will appear. Even if I set the plugin like below

import Vue from 'vue'
import CRow from '~/components/grid/row'
import CCol from '~/components/grid/col'
import Message from '~/components/common/message'

export default () => {
}

I just import the vue and my component, the problem still appears. So I try not to import the vue, but it is not OK.I think it's my component problem. But my component is normal. So I want to know,
whether plugin like that cant be put in vendor.
The problem is here:

aa

When I remove the plugin from vendor, it will work.

The problem may be related to the css link. However I don‘’t know the reason.I use the scss.

@clarkdo
Copy link
Member

clarkdo commented Jan 12, 2018

Can you provide you repo ?

@RhysXia
Copy link
Author

RhysXia commented Jan 12, 2018

you can see the demo here
nuxt-demo

@clarkdo
Copy link
Member

clarkdo commented Jan 12, 2018

@RhysXia It looks that codes of the repo is not same as you described above, and I didn't find any error in console by npm run dev.

@RhysXia
Copy link
Author

RhysXia commented Jan 12, 2018

@clarkdo It is just a demo of my problem.

In my problem, the key is: I can't add a component plugin into vendor and set extractCSS:true.

You can run the demo I give.The problem will happen like I show above.
the dome use the template.I just add a plugin and set nuxt.config.js below

  plugins: [
    '~/plugins/components'
    // {src: '~/plugins/offline', ssr: false}
  ],
  build: {
    vendor: [
      '~/plugins/components'
    ],
    extractCSS: true
  }

@clarkdo
Copy link
Member

clarkdo commented Jan 12, 2018

I did what you showed, but there is no error in console.

@RhysXia
Copy link
Author

RhysXia commented Jan 12, 2018

you should build it and npm run start

@clarkdo
Copy link
Member

clarkdo commented Jan 12, 2018

It seemd to be an issue from webpack
For a quick fix you can always add allChunks: true.

@RhysXia
Copy link
Author

RhysXia commented Jan 12, 2018

okay, thank you for answer

@clarkdo
Copy link
Member

clarkdo commented Jan 12, 2018

There are some other solutions also in webpack-contrib/extract-text-webpack-plugin#456.

@RhysXia
Copy link
Author

RhysXia commented Jan 12, 2018

okay,now I just remove it from vendor.

@clarkdo
Copy link
Member

clarkdo commented Jan 12, 2018

Fixed in 28d3e6f, will be included in next release

@lock
Copy link

lock bot commented Nov 2, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 2, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants