diff --git a/package.json b/package.json index e7441e02..acf7b85f 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "src/index.js", "scripts": { "clean": "rimraf dist/*", - "start": "webpack-dev-server --mode development --open --hot --config webpack.config.dev.js", - "dist": "npm run clean && webpack --mode production --config webpack.config.prod.js", + "start": "webpack-dev-server --mode development --open --hot --config webpack.config.js", + "dist": "npm run clean && webpack --mode production --config webpack.config.js", "deploy": "npm run dist && gh-pages -d dist", "build:docker": "npm run dist && docker build -t reactdocker .", "lint": "eslint ./src", diff --git a/postcss.config.js b/postcss.config.js index 7640c748..878c317a 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,6 @@ // browser support list see here: https://github.com/ai/browserslist#queries module.exports = ({ file, options, env }) => ({ plugins: { - 'autoprefixer': { browsers: 'last 2 version' }, + autoprefixer: { browsers: 'last 2 version' }, } -}); \ No newline at end of file +}); diff --git a/src/containers/index.js b/src/containers/index.js index 1c885fe6..9a52f302 100644 --- a/src/containers/index.js +++ b/src/containers/index.js @@ -3,8 +3,9 @@ import React, { Component } from 'react'; export default class Main extends Component { render() { return ( -
- Hello, I`m ReactMaker. +
+

Hello, I`m ReactMaker.

+

To get started, edit containers/index.js

); } diff --git a/src/index.js b/src/index.js index 1d963e29..900d80bc 100644 --- a/src/index.js +++ b/src/index.js @@ -1,25 +1,24 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { AppContainer } from 'react-hot-loader'; -import Main from 'containers/'; -ReactDOM.render( - -
- , - document.getElementById('app') -); +const render = () => { + const Main = require('containers').default; + + ReactDOM.render( + +
+ , + document.getElementById('app') + ); +}; + +render(); // migrate by this guide // https://github.com/gaearon/react-hot-loader/tree/master/docs#migration-to-30 if (module.hot) { module.hot.accept('containers/', () => { - const NewMain = require('containers/').default; - ReactDOM.render( - - - , - document.getElementById('app') - ); + render(); }); } diff --git a/webpack.config.dev.js b/webpack.config.dev.js deleted file mode 100644 index baeff796..00000000 --- a/webpack.config.dev.js +++ /dev/null @@ -1,6 +0,0 @@ -const config = require('./webpack.config.base'); -const webpack = require('webpack'); -// change your production config here; -config.plugins.push(new webpack.DefinePlugin({ ENV: JSON.stringify('dev') })); - -module.exports = config; \ No newline at end of file diff --git a/webpack.config.base.js b/webpack.config.js similarity index 99% rename from webpack.config.base.js rename to webpack.config.js index 02e30695..b80d6270 100644 --- a/webpack.config.base.js +++ b/webpack.config.js @@ -1,5 +1,6 @@ const path = require('path'); const HtmlWebPackPlugin = require("html-webpack-plugin"); + module.exports = { module: { rules: [ diff --git a/webpack.config.prod.js b/webpack.config.prod.js deleted file mode 100644 index 7e5db050..00000000 --- a/webpack.config.prod.js +++ /dev/null @@ -1,6 +0,0 @@ -const config = require('./webpack.config.base'); -const webpack = require('webpack'); -// change your production config here; -config.plugins.push(new webpack.DefinePlugin({ ENV: JSON.stringify('production') })); - -module.exports = config; \ No newline at end of file