Webpack'i ilk kez deniyorum ve çalışmaya başlamak için this tutorial'u kullanın ve react.js'yi ekleyin.Webpack: node_modules/css/index.js bir işlev döndürmedi
Adımları tamamladıktan ve style
ve css
modüllerini yükledikten sonra, css modülünün bir işlev döndürmediği konusunda bir hata alıyorum.
Bu
benim index.jsx geçerli:/** @jsx React.DOM */
'use strict';
require('../css/normalize.css');
var React = require('react');
var Hello = require('./Test/Hello');
React.render(<Hello />, document.getElementById('content'));
Ve webpack yapılandırma dosyası:
module.exports = {
entry: './ui/src/index.jsx',
output: {
path: __dirname + '/build-ui',
filename: 'app.js', //this is the default name, so you can skip it
//at this directory our bundle file will be available
//make sure port 8090 is used when launching webpack-dev-server
publicPath: 'http://localhost:8090/assets'
},
module: {
loaders: [
{
//tell webpack to use jsx-loader for all *.jsx files
test: /\.jsx$/,
loader: 'jsx-loader?insertPragma=React.DOM&harmony'
},
{
test: /\.css$/,
loader: "style!css"
},
{
test: /\.scss$/,
loader: "style!css!sass"
}
]
},
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']
}
};
webpack her zaman aşağıdaki hatayı bildiren projeyi paket çalıştığında:
ERROR in Loader /Users/Johannes/Documents/Development/holmes/node_modules/css/index.js didn't return a function
@ ./ui/src/index.jsx 5:0-31
Bu konuda ne yapacağımı bilmiyorum. Bu sorunla karşılaştı mı? Ve bunu nasıl çözebilirim?
holmes/
ui/
css/
normalize.css
src/
Test/
Hello.jsx
index.jsx
index.html
package.json
webpack.config.js
Ne tür bir dizin yapınız var? –
Bu arada, sizinkine karşı karşılaştırmak istediğinizde [çalışan bir kurulum] (https://github.com/bebraw/react-component-boilerplate) var. –
Soruna hiyerarşi ekledim. –