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

Coffeescript Vuex silently stop working on 2.5.1 #5423

Closed
chiboreache opened this issue Mar 30, 2019 · 10 comments · Fixed by #6248
Closed

Coffeescript Vuex silently stop working on 2.5.1 #5423

chiboreache opened this issue Mar 30, 2019 · 10 comments · Fixed by #6248

Comments

@chiboreache
Copy link

Version

v2.5.1

Reproduction link

https://github.com/nuxt/nuxt.js/tree/dev/examples/coffeescript

Steps to reproduce

Build project with "nuxt": "2.5.1"

What is expected ?

Vuex that works with Coffeescript, just like on 2.4.5

What is actually happening?

Nothing.

This bug report is available on Nuxt community (#c8960)
@ghost ghost added the cmty:bug-report label Mar 30, 2019
@kyrsquir
Copy link

kyrsquir commented Apr 8, 2019

I would also note that if I enable module store in the coffeescript example by adding a file /store/module.coffee

export state = ->
  message: 'Hello CoffeeScript Module Store!'

and try to reference it in pages/index.vue

export default
  components: { Logo }
  computed:
    message: -> @$store.state.module.message

with Nuxt 2.5.1+ I get

ERROR  [Vue warn]: Error in render: "TypeError: Cannot read property 'message' of undefined"

@manniL manniL added the pending label Apr 8, 2019
@weotch
Copy link

weotch commented May 2, 2019

It appears to have broken a little earlier than reported above, I see it broken in 2.5.0. And is still an issue in 2.6.3.

@weotch
Copy link

weotch commented May 2, 2019

I've been digging into the code and I'm not use exactly where it broke, but I've found changing resolveFiles() to this:

  async resolveFiles(dir, cwd = this.options.srcDir) {
    const extensions = this.supportedExtensions.concat(this.nuxt.options.extensions)
    return this.ignore.filter(await glob(`${dir}/**/*.{${extensions.join(',')}}`, {
      cwd,
      ignore: this.options.ignore
    }))
  }

fixes the issue; the coffeescript store module gets found. What I'm doing is concat-ing the this.nuxt.options.extensions onto the this.supportedExtensions array, which is the only list of extensions currently being considered when resolving store modules.

The above is a clunky solve not worthy of a PR, but should point out the problem is that this.nuxt.options.extensions isn't taken into account when Nuxt looks for store modules. However, this is the practice described in the coffeescript example.

weotch added a commit to BKWLD/nuxt-coffeescript-module that referenced this issue May 2, 2019
@weotch
Copy link

weotch commented May 2, 2019

I have a workaround that I published to my CoffeesScript Nuxt module package: BKWLD/nuxt-coffeescript-module@143656e. This fixes this VueX issue for me but doesn't fix the issue with CoffeeScript local modules #5087

@chiboreache
Copy link
Author

@weotch
oh, that's really nice, thanks! I'll try when I get back to the Nuxt

@chiboreache
Copy link
Author

chiboreache commented May 11, 2019

WORKS PERFECTLY FINE !
with 2.6.3

definitely need to add this two lines of code into master branch as fast as possible!

@chiboreache
Copy link
Author

workaround is working like a charm too!

@manniL
Copy link
Member

manniL commented May 20, 2019

Feel free to create a PR for the example to make it work too, or even to the core ☺️

@weotch
Copy link

weotch commented May 21, 2019

I wasn't sure if my workaround should be the right solve for this ... like, ideally, I feel like Nuxt should use the this.nuxt.options.extensions for the builder.supportedExtensions as well. It wasn't clear to me where the most elegant way to implement this into the core should be, though.

@chiboreache
Copy link
Author

@manniL hey did you fixed coffeescript linter issue of your CI ?

@Atinux Atinux added this to Need Repro in Bugs 🐞 Aug 8, 2019
@Atinux Atinux moved this from Need Repro to Open in Bugs 🐞 Aug 8, 2019
@pi0 pi0 closed this as completed in #6248 Aug 20, 2019
Bugs 🐞 automation moved this from Open to Fixed Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Bugs 🐞
  
Fixed
Development

Successfully merging a pull request may close this issue.

5 participants