sass值取决于父母

时间:2016-11-14 21:50:40

标签: javascript reactjs ecmascript-6

我的反应应用中有以下反应代码,由webpack / babel传播:

import React from 'react';
import ReactDOM from 'react-dom';


class world extends React.Component {
  render() {
    return <h1>World</h1>
  }
}

ReactDOM.render(<world/>, document.getElementById('js-app'));

然而,结果并非我的预期,它只会呈现:

<world data-reactroot></world>

However the result is not what I expected, it only renders "<world data-reactroot></world>"

这是我的webpack.config文件:

var path = require("path"),
    webpack = require("webpack"),
    watchBabel = require("watch-babel"),
    srcJsDir = "assets/js/custom/",
    srcCssDir = "assets/sass/",
    srcDestJsDir = "assets/js/transpiled/",
    options = { glob: "src/*.js" },
    optionsCss = { glob: "src/*.scss" };

module.exports = {

    entry: ["./assets/js/custom/app.js"],
    output: {
        path: "./assets/js/transpiled/",
        filename: "app.es6c.js"
    },
    watch: true,
    devServer: {
        inline: true,
        port: 8000
    },
    module: {
        loaders: [{
            test: /\.js$/,
            exclude: /(node_modules|bower_components)/,
            loader: ['babel-loader'],
            query: {
                presets: ["react", "es2015", "stage-0"]
            }
        }]
    },
    resolveLoader: {
        root: path.join(__dirname, 'node_modules/')
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: JSON.stringify("production")
            }
        })
    ]
};
你能告诉我哪里出错吗?提前谢谢。

0 个答案:

没有答案