使用React和WebPack配置Cordova

时间:2017-04-21 10:06:18

标签: cordova reactjs webpack babeljs

您好我想配置我的cordova应用程序以使用reactJs。为此,我使用webpack。 当我运行webpack时出现以下错误:

    var path = require('path');
var webpack = require("webpack");

module.exports = {
    entry: {
        app: ['webpack/hot/dev-server', './www/js/index.js']
    },
    output: {
        path: __dirname + '/www/',
        filename: 'bundle.js'
    },
    devServer: {
        contentBase: './www',
        publicPath: 'http://localhost:8080/'
    },

    module: {
        loaders: [{
                test: /\.jsx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
                query: {
                    presets: ['es2015', 'react'],
                    plugins: ['transform-class-properties']
                },
            },
            { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' },
            { test: /\.css$/, loader: 'style-loader!css-loader' },
            {
                test: /\.(eot|svg|ttf|woff|woff2|otf)$/,
                loader: 'file?name=fonts/montserrat/[name].[ext]'
            },
            {
                test: /\.elm$/,
                exclude: [/elm-stuff/, /node_modules/],
                loader: 'elm-webpack'
            }
        ],
        noParse: /\.elm$/
    },

    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.IgnorePlugin(new RegExp("^(fs|ipc)$"))
    ]
};

如果你想看到我的webpack配置:

<table ui-tree="treeOptions">
<tbody ui-tree-nodes data-max-depth="2" ng-model="row">
<!-- Builds Day View with one <tr> for each hour(24 hrs) in rows model --> 
<tr ng-repeat="tm in rows track by $index" ng-model="rows" ui-tree-node>
    <td class="calendar-cell">
        <!-- hourTouch() counts the touch events, once shows <p>Signup</p>, twice  -->
        <!-- shows <div class="finish-time"> which is my draggable element -->
        <!-- tm.events is an array of objects with the event detail properties -->
        <div class="add_event_shade" 
                ng-if="tm.events" 
                on-touch="hourTouch($event)"
                ng-model="tm.events"
                ui-tree-nodes="">
            <p style="display:none;" 
                 ng-model="volunteerStart">
                 Signup
            </p>
            <div class="finish-time"
                    style="display:none";
                    ui-tree-node>
                    Finish: {{ displayEnd}}
            </div>
        </div>
        <div ng-class="{'calendar-event-wrap': tm.events}"
                ng-show="tm.events">
            <!-- adds events to the calendar day view -->
            <div ng-repeat="displayEvent in tm.events" 
                   class="calendar-event"
                   ng-click="eventSelected({event:displayEvent.event})"
                <div class="calendar-event-inner"></div>
            </div>
        </div>
    </td>
</tr>
</tbody>

我不明白我的错误,请帮帮我!!!!

0 个答案:

没有答案