I have this Babel loader that's working
{ test: /\.jsx?$/, loader: 'babel', query: babelSettings, exclude: /node_modules/ },
But now I want a CoffeeScript loader but I want to pipe it through Babel to get the the fancy HMR stuff
{ test: /\.coffee$/, loader: 'babel!coffee', query: babelSettings, exclude: /node_modules/ },
This doesn't work though, and results in the following error.
Error: Cannot define 'query' and multiple loaders in loaders list
Any idea how to define the query just for the Babel part of the loader chain? The query is a complicated object and I don't think I can encode it.
var babelSettings = { stage: 0 };
if (process.env.NODE_ENV !== 'production') {
babelSettings.plugins = ['react-transform'];
babelSettings.extra = {
'react-transform': {
transforms: [{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module']
}, {
transform: 'react-transform-catch-errors',
imports: ['react', 'redbox-react']
}]
// redbox-react is breaking the line numbers :-(
// you might want to disable it
}
};
}