cercato di utilizzare il modulo NPM reagire-spin, ma quando provo e costruire un bundle.js con webpack, ricevo il seguente errore:Webpack con reagiscono moduli dando inaspettato gettone
Module parse failed: /Users/nir/browsewidget/node_modules/react-spin/src/main.js Line 29: Unexpected token <
You may need an appropriate loader to handle this file type.
| render: function() {
| return (
| <span ref="container" />
| );
| }
@ ./js/widget.jsx 4:14-35
sto indovinando che questo modulo ha jsx, ma non capisco perché non possa essere costruito? Lo spin di reazione richiede qualche configurazione extra quando si costruisce un bundle?
Ecco il mio pieno webpack.config.js:
module.exports = {
entry: "./js/widget.jsx",
output: {
path: __dirname,
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.jsx$/,
loader: 'jsx-loader?insertPragma=React.DOM&harmony'
}
]
},
externals: {
//don't bundle the 'react' npm package with our bundle.js
//but get it from a global 'React' variable
'react': 'React'
},
resolve: {
extensions: ['','.js','.jsx']
}
};
Grazie, hai fatto un buon punto. Ho finito per includere la mia reazione nel mio progetto. – ApathyBear