0

This is my webpack-config.js:

module.exports = {
        entry: "./src/js/main.js",
        output: {
            path: './dist',
            filename: 'bundle.js',
            publicPath: './dist'
        }, 
        devServer:{
            inline: true,
        contentBase: './dist'
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                exclude: /(node_modules|bower_components)/,
                loader:'babel',
                query: {
                    presets: ['es2015', 'react']
                }
            }
        ]
    }
}

I created simple component App.js:

import React from 'react';

export default class App extends React.Component{
    render(){
        return <h1>Hello</h1>
    }
}

and my main.js:

import React from 'react';
import { render } from 'react-dom';
import App from './components/App.js';

render(<App/>, document.getElementById('main'));

My index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <div id="main"></div>
    <script src="bundle.js">,/scrip>
</body>
</html>

when I run webpack-dev-server, there is no errors, it is serve right folder , but I see empty page, with no errors in the WEB console. I see it loads the right file with id main, but thats all.

Where is the problem ?

6
  • Do you have an index.html? Commented Nov 26, 2016 at 0:02
  • Yes, like i wrote I see it loads the right file with id main Commented Nov 26, 2016 at 0:04
  • And did you link your bundle.js with <script src="bundle.js"> in the index? Commented Nov 26, 2016 at 0:05
  • Yes, I edit the question to be clear, thx. Commented Nov 26, 2016 at 0:08
  • 1
    Is it a typo or <script src="bundle.js">,/scrip> should be <script src="bundle.js"></script> ? Commented Nov 26, 2016 at 0:30

2 Answers 2

2

in your html file, the closing script tag is broken.

,/scrip>

Sign up to request clarification or add additional context in comments.

Comments

1

your file is named App.jsx but you're trying to import from App.js

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.