Próbuje sobie skompilować pliki ReactJS w Webpacku lecz on nie widzi poszczególnych modułów. Prosze o rady. W załączniku wrzucam screen z debbuga, natomiast poniżej kod:
webpackconfig:
var path = require('path');
var webpack = require('webpack');
module.exports = {
output: {
path: path.join(__dirname,"build"),
filename: 'bundle.js'
},
entry: ['./src/App.jsx'],
plugins: [
// Avoid publishing files when compilation fails
new webpack.NoErrorsPlugin()
],
stats: {
// Nice colored output
colors: true
},
devtool: 'source-map',
resolve: {
extensions: ['','.js', '.jsx']
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['react', 'es2015']
}
},
]
}
};
App.jsx:
import React from 'react';
import {Router, Route, IndexRoute, Redirect} from 'react-router';
import DefaultLayout from './layouts/Default';
import HomePage from './components/Home';
import PrivacyPage from './components/Privacy';
export const routes = (
<Route path='/' component={DefaultLayout}>
<IndexRoute component={HomePage} />
<Route path='privacy' component={PrivacyPage} />
<Route path='*' component={NotFound} />
</Route>
)
- webpack debug.jpg (119 KB) - ściągnięć: 189
Maciej Cąderek