Skip to content

Instantly share code, notes, and snippets.

@pikeas
Created October 15, 2014 10:16
Show Gist options
  • Save pikeas/4457e6e56f02b7bb1a07 to your computer and use it in GitHub Desktop.
Save pikeas/4457e6e56f02b7bb1a07 to your computer and use it in GitHub Desktop.
ERROR in ./app/Main.jsx
Module parse failed: /Users/pikeas/Documents/code/pypjs/crypto/front/react-starter/app/Main.jsx Line 19: Unexpected token <
You may need an appropriate loader to handle this file type.
| var Application = React.createClass({
| render: function() {
| return <Example />;
| }
| });
@ ./config/app.jsx?Main 4:18-64
# Coffeescript rewrite of https://github.com/webpack/react-starter/blob/master/make-webpack-config.js
# Should be basically identical...(famous last words)
# But npm run dev-server fails with errors attached as next file
# https://github.com/webpack/react-starter
webpack = require 'webpack'
_loaders =
coffee: 'coffee-redux'
# Tried this with and without the insertPragma. Fails either way.
jsx: 'jsx?insertPragma=React.DOM'
json: 'json'
'png|jpg|jpeg|gif|svg': 'url?limit=10000'
woff: 'url?limit=100000'
'ttf|eot': 'file'
html: 'html'
css: 'css'
less: 'css!less'
styl: 'css!stylus'
sass: 'css!sass'
base = (options={}) ->
options.debug ?= false
config =
entry:
main: './config/app?Main'
output:
path: __dirname + '/build/public'
pathinfo: options.debug
publicPath: '/'
filename: '[name].js',
chunkFilename: '[name].js'
sourceMapFilename: 'debugging/[file].map'
module:
loaders: ({test: ///\.(#{ext})(\?.*)$///, loader: loader} for ext, loader of _loaders)
resolve:
root: __dirname + '/app',
extensions: [ '', '.web.js', '.js', '.jsx' ]
plugins: [
# TODO stats output plugin
new webpack.PrefetchPlugin('react')
new webpack.PrefetchPlugin('react/lib/ReactComponentBrowserEnvironment')
]
debug: options.debug
if options.devtool?
config.devtool = options.devtool
config
dev = () ->
config = base({devtool: 'eval', debug: true})
config.entry.main = ['webpack-dev-server/client?http://localhost:2992', './config/app?Main']
config.output.chunkFilename = '[id].js'
config
module.exports = (type) ->
switch type
when 'dev' then dev()
when 'hot-dev' then 'TODO hot'
when 'prod' then 'TODO prod'
else base()
require('coffee-script/register');
//module.exports = require("./make-webpack-config")({
//});
module.exports = require('./webpack.config.coffee');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment