browserify / watchify

watch mode for browserify builds
Other
1.79k stars 203 forks source link

Unexpected token when using watchify > 3.3.1 with -t coffee-reactify or -t coffeeify #296

Closed nakwa closed 6 years ago

nakwa commented 8 years ago

Hi, Just pointing out an issue I've been having:

When using watchify with this package.json, I systematically get a Unexpected token (1:xx) for every coffee-script file required in the main application file (app.coffee).

nakwa~/Projects/my_app (master)$ npm run dev

> myApp@1.0.0 dev /Users/nakwa/Projects/my_app
> npm run watchify

> myApp@1.0.0 watchify /Users/nakwa/Projects/my_app
> watchify -t coffee-reactify ./sources/app.coffee -o ./build/app.js

Error: Parsing file /Users/nakwa/Projects/my_app/sources/config.coffee: Unexpected token (1:12)
Error: Parsing file /Users/nakwa/Projects/my_app/sources/constants.coffee: Unexpected token (1:20)
Error: Parsing file /Users/nakwa/Projects/my_app/sources/router.coffee: Unexpected token (1:12)
Error: Parsing file /Users/nakwa/Projects/my_app/sources/dispatcher.coffee: Unexpected token (1:20)
  "scripts": {
    "watchify": "watchify -t coffee-reactify ./sources/app.coffee -o ./build/fidorx.js",
    "build": "browserify -t coffee-reactify ./sources/app.coffee -o ./build/fidorx.js",
    "dev": "npm run watchify"
  },
  "dependencies": {
    "backbone": "^1.2.3",
    "bootstrap": "^3.3.5",
    "coffee-reactify": "^4.0.0",
    "coffee-script": "^1.10.0",
    "flux": "^2.1.1",
    "jquery": "^2.1.4",
    "keymirror": "^0.1.1",
    "lodash": "^3.10.1",
    "react": "^0.14.2",
    "react-dom": "^0.14.2",
    "underscore": "^1.8.3"
  },
  "devDependencies": {
    "browserify": "^11.0.1",
    "coffee-react-transform": "^2.1.0",
    "coffee-reactify": "^2.1.0",
    "coffee-script": "^1.10.0",
    "coffeeify": "^1.1.0",
    "watchify": "^3.7.1"
  }

In the meantime, the same command using browserify (here npm run build) is working. I had to downgrade to watchify 3.3.1 in order to make in work with my application, while I guess the latest version of browserify and the latest version of watchify should have the same behavior.

Best,

zertosh commented 8 years ago

There's not enough information here to figure out what's going on. Can you provide a minimal way to reproduce the issue? (see https://github.com/substack/node-browserify/wiki/How-to-report-issues-with-browserify#example)