KyleAMathews / cjsx-loader

coffee-react-transform loader module for webpack
53 stars 11 forks source link

cjsx-loader does not parse when being used as loader in Karma and webpack setup #11

Closed ivancho98 closed 8 years ago

ivancho98 commented 8 years ago

In a karma and webpack setup, karma shows the following warning:

WARNING in ./test/component_spec.cjsx
Module parse failed: /home/ivan/BestMile/testing/coffee-react-karma-webpack-phantomjs/node_modules/cjsx-loader/index.js!/home/ivan/BestMile/testing/coffee-react-karma-webpack-phantomjs/test/component_spec.cjsx Line 1: Unexpected string
You may need an appropriate loader to handle this file type.
| rewire = require 'rewire'
| mockComponent = require './support/mock_component'
| React = require 'react/addons'
 @ ./test _spec$

WARNING in ./test/link_spec.cjsx
Module parse failed: /home/ivan/BestMile/testing/coffee-react-karma-webpack-phantomjs/node_modules/cjsx-loader/index.js!/home/ivan/BestMile/testing/coffee-react-karma-webpack-phantomjs/test/link_spec.cjsx Line 1: Unexpected string
You may need an appropriate loader to handle this file type.
| React = require 'react/addons'
| TestUtils = React.addons.TestUtils
| Link = require '../src/link'
 @ ./test _spec$

WARNING in ./test/nested/button_spec.cjsx
Module parse failed: /home/ivan/BestMile/testing/coffee-react-karma-webpack-phantomjs/node_modules/cjsx-loader/index.js!/home/ivan/BestMile/testing/coffee-react-karma-webpack-phantomjs/test/nested/button_spec.cjsx Line 1: Unexpected string
You may need an appropriate loader to handle this file type.
| React = require 'react/addons'
| TestUtils = React.addons.TestUtils
| Button = require '../../src/nested/button'
 @ ./test _spec$
08 12 2015 16:29:27.342:WARN [karma]: No captured browser, open http://localhost:9876/
08 12 2015 16:29:27.348:INFO [karma]: Karma v0.13.15 server started at http://localhost:9876/
08 12 2015 16:29:27.352:INFO [launcher]: Starting browser PhantomJS
08 12 2015 16:29:27.571:INFO [PhantomJS 1.9.8 (Linux 0.0.0)]: Connected on socket WdOa2N8udaAdoJWqAAAA with id 21165775
PhantomJS 1.9.8 (Linux 0.0.0): Executed 0 of 0 ERROR (0.039 secs / 0 secs)

This does happen when using the coffee-jsx-loader, so I do not think it is a Karma problem.

KyleAMathews commented 8 years ago

It looks like you've misconfigured your Webpack somehow as it's not setup to use this loader in that stack trace.