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 2 support #39

Closed
michaelforrest opened this issue May 26, 2017 · 21 comments
Closed

CoffeeScript 2 support #39

michaelforrest opened this issue May 26, 2017 · 21 comments

Comments

@michaelforrest
Copy link

I'd like to try CoffeeScript 2 in my project but I get [email protected] requires a peer of [email protected] but none was installed.

I'll see what happens if I change this and submit a PR if it seems to work okay?

@michaelforrest
Copy link
Author

Or I could try this for now iHaiduk@9e759db

@alexander-akait
Copy link
Member

@michaelforrest seems CoffeeScripts v2 in beta, i think it is breaking changes. Let's wait stable release and upgrade loader deps

@buhrmi
Copy link

buhrmi commented Jun 28, 2017

So it looks like the peerDependencies in package.json have been updated to work with coffeescript 2, but the the package version was kept at 0.7.3. Could you update the version (probably 0.8.0) and publish it on npm?

@beeplin
Copy link

beeplin commented Jun 30, 2017

agree. The previous commit (5c5e35a) has done the coffeescript2 support, but not published to npm yet.

@molszanski
Copy link

Npm publish pls? :) Even with a beta tag

@buhrmi
Copy link

buhrmi commented Jul 27, 2017

what's the holdup? we're all waiting :o

@objectkit
Copy link

objectkit commented Aug 1, 2017

Hoping to use coffeescript-beta3 in pending web pack project. Could you let us know the NPM publish ETA please?

WORKAROUND
Running cd node_modules && ln -s coffeescript coffee-script from project root seems to be a viable short term workaround for 0.7.3...

@molszanski
Copy link

Or add this to package.json
"coffee-loader": "github:webpack-contrib/coffee-loader#0ea4d6a7cc9ffc7c8f7a0c6eb3fd3fedea9943b8",

@oedotme
Copy link

oedotme commented Aug 3, 2017

By requiring coffeescript instead of coffee-script in line 5 in 'node_modules/coffee-loader/index.js' did work for me and i was able to use jsx as v2 supports.
i don't know if an 'or' could do for both coffee-script, coffeescript

@edmiester777
Copy link

The workaround that I use is to define a module alias. The package module-alias helps you do this.
npm i --save module-alias

Then I have my package.json like this:

    "_moduleAliases": {
        "coffee-script": "node_modules/coffeescript/lib/coffeescript"
    }

And I just call require('module-alias/register') at the beginning of my application and it reroutes the "coffee-script" require to the new "coffeescript" require for CS2.

@alexander-akait
Copy link
Member

If someone is interested in helping with coffee-loader PR welcome.

@renchap
Copy link

renchap commented Aug 23, 2017

@evilebottnawi 5c5e35a switched from coffee-script to coffeescript (the new package name). This allows using coffee-loader with CoffeeScript 1 and CoffeeScript 2 (with coffeescript@beta).

The problem is that coffee-loader has not been released on NPM, so people need to rely on the git version or some hacks. If you can get a new coffee-loader released on NPM, this would solve the issue :)

@alexander-akait
Copy link
Member

@renchap Send request on release in slack, thanks!

@beeplin
Copy link

beeplin commented Aug 23, 2017

thanks @evilebottnawi . That would be a life saver! 👍

@joshwiens
Copy link
Member

@renchap - Latest master has been released as 0.8.0. Changelog with the permanent information for this release can be found here

@renchap
Copy link

renchap commented Aug 23, 2017

@d3viant0ne Thanks a lot!
I can confirm CoffeeScript 2 integration works with Webpack (2.6). My package.json contains:

{
  "dependencies": {
    "coffeescript": "next",
    "coffee-loader": "^0.8.0"
  }
}

This issue should be closed.

@c5n8
Copy link

c5n8 commented Sep 29, 2017

Does anybody use coffescript 2 in nuxt vue component? I am trying to get it works, but still failing.
[email protected] is used.

 ERROR  Failed to compile with 1 errors                                                                                      13:10:20

 error  in ./pages/index.vue


/home/chabib/Code/mediaplan/pages/index.vue
  15:13  error  Parsing error: Unexpected token, expected ;

  2 | 
  3 | export default
> 4 |   components:
    |             ^
  5 |     {
  6 |       Logo
  7 |     }

✖ 1 problem (1 error, 0 warnings)


 @ ./.nuxt/router.js 7:9-75
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?name=client&reload=true&timeout=3000&path=/__webpack_hmr ./.nuxt/client.js

Here's the code:

index.vue

...

<script lang="coffee">
import Logo from '~/components/Logo.vue'

export default
  components:
    {
      Logo
    }

  data: ->
    id: 1
</script>

...

package.json

...

  "devDependencies": {
    "babel-eslint": "^7.2.3",
    "coffee-loader": "^0.8.0",
    "coffeescript": "^2.0.1",
    "eslint": "^4.3.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-html": "^3.1.1",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.1.1",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-standard": "^3.0.1",
    "pug": "^2.0.0-rc.4",
    "pug-loader": "^2.3.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1"
  }

...

@c5n8
Copy link

c5n8 commented Sep 29, 2017

Welp, looks like when using coffescript I have to disable eslint

@garviand
Copy link

garviand commented Jan 15, 2018

Still get the same error

in package.json

"coffee-loader": "0.9.x",
"coffeescript": "2.1.x",

error:

Error: ./views/js/main.coffee
Module parse failed: Unexpected token (17:11)
You may need an appropriate loader to handle this file type.

Note that the file in question contains jsx, which should be natively supported

@molszanski
Copy link

@garviand, what do you mean by "the same"?

Just to be sure, have you tried completely removing node_modules and reinstalling it again? Just to make sure you are really using the latest versions?

@garviand
Copy link

An error on my end. I was compiling coffeescript before calling webpack functions... Sorry!

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